1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-11 20:58:27 +03:00

fuzz: decompress_startswith() may return zero

Fixes #36472.

(cherry picked from commit 339f2f2eeb883b201f59076900e3bee7ff143460)
(cherry picked from commit 5e00d957baea4731cd08508141e9d3c807011312)
This commit is contained in:
Yu Watanabe 2025-02-23 04:59:46 +09:00 committed by Luca Boccassi
parent 703d2973ea
commit 06f967b820
3 changed files with 4 additions and 3 deletions

View File

@ -5,6 +5,7 @@
#include "alloc-util.h" #include "alloc-util.h"
#include "compress.h" #include "compress.h"
#include "fuzz.h" #include "fuzz.h"
#include "tests.h"
typedef struct header { typedef struct header {
uint32_t alg:2; /* We have only three compression algorithms so far, but we might add more in the 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); 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_OK(decompress_startswith(alg, buf, csize, &buf2, h->data, sw_len, h->data[sw_len]));
assert_se(r > 0);
return 0; return 0;
} }

View File

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

View File

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