1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-21 02:50:18 +03:00

fuzz: decompress_startswith() may return zero (#36490)

Also, disables fuzz-compress on oss-fuzz.
Fixes #36472.
This commit is contained in:
Yu Watanabe 2025-02-25 11:05:06 +09:00 committed by GitHub
commit 1930f5afe6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 9 additions and 4 deletions

View File

@ -5,6 +5,7 @@
#include "alloc-util.h"
#include "compress.h"
#include "fuzz.h"
#include "tests.h"
typedef struct header {
uint32_t alg:2; /* We have only three compression algorithms so far, but we might add more in the
@ -59,8 +60,6 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
size_t sw_len = MIN(data_len - 1, h->sw_len);
r = decompress_startswith(alg, buf, csize, &buf2, h->data, sw_len, h->data[sw_len]);
assert_se(r > 0);
ASSERT_OK(decompress_startswith(alg, buf, csize, &buf2, h->data, sw_len, h->data[sw_len]));
return 0;
}

View File

@ -5,7 +5,6 @@ simple_fuzzers += files(
'fuzz-bus-label.c',
'fuzz-calendarspec.c',
'fuzz-catalog.c',
'fuzz-compress.c',
'fuzz-env-file.c',
'fuzz-hostname-setup.c',
'fuzz-json.c',
@ -14,3 +13,8 @@ simple_fuzzers += files(
'fuzz-varlink.c',
'fuzz-varlink-idl.c',
)
# The following fuzzers do not work on oss-fuzz. See #11018.
if not want_ossfuzz
simple_fuzzers += files('fuzz-compress.c')
endif

View File

@ -1,5 +1,6 @@
/*/* -whitespace
/fuzz-bus-match/* binary
/fuzz-compress/* binary
/fuzz-dhcp*/* binary
/fuzz-dns-packet/* binary
/fuzz-fido-id-desc/ binary

View File

@ -0,0 +1 @@
゙0000000000゙000000000000000000000