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.
This commit is contained in:
Yu Watanabe 2025-02-23 04:59:46 +09:00
parent 8e0037fb3b
commit 339f2f2eeb
3 changed files with 4 additions and 3 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

@ -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