tests: Skip test leaking handle under valgrind

This is leaking memory allocated in process_open(), which is stored in the
handles list in the sftpserver session. Given that the data is provided by the
use callbacks, we can not universally free them on our side, but we should, in
the long term, introduce some way for the implementers to free outstanding
handles that were not closed by misbehaving clients.

Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Reviewed-by: Andreas Schneider <asn@cryptomilk.org>
This commit is contained in:
Jakub Jelen
2025-07-24 17:47:58 +02:00
committed by Andreas Schneider
parent 08a32ac381
commit c4c28c6473

View File

@@ -31,6 +31,10 @@
#include <errno.h>
#include <pwd.h>
#ifdef HAVE_VALGRIND_VALGRIND_H
#include <valgrind/valgrind.h>
#endif
#include "libssh/buffer.h"
#include "libssh/libssh.h"
#include "libssh/priv.h"
@@ -1199,6 +1203,20 @@ static void torture_server_sftp_payload_overrun(void **state)
uint32_t id, bad_payload_len = 0x7ffffffc;
int rc;
#ifdef HAVE_VALGRIND_VALGRIND_H
if (RUNNING_ON_VALGRIND) {
/* This malformed message does not crash the server, but keeps waiting
* for more data as announced in the payloiad length so the opened FD on
* the server side is leaking when the server terminates.
* Given that the custom sftp server could store anything into the
* handles, it should take care of cleaning up the outstanding handles,
* but this is something to solve in the future. Now just skipping the
* test.
*/
skip();
}
#endif /* HAVE_VALGRIND_VALGRIND_H */
assert_non_null(tss);
s = tss->state;