1
0
mirror of https://github.com/systemd/systemd.git synced 2024-10-30 14:55:37 +03:00

fuzz-journal-remote: allow -ENODATA too

It seems that we try to create a new file, which fails with -ENOSPC, and we
later fail when reading a file with ENODATA.  journal_file_open() will return
-ENODATA if the file is too short or if journal_file_verify_header() fails.
We'll unlink a file we newly created if we fail to initialize it immediately
after creation. I'm not sure if the file we fail to open is the one we newly
created and e.g. failed to create the arena and such, or if it's the file we
were trying to rotate away from. Either way, I think we should be OK with
with a non-fully-initialized journal file.

Failed to create rotated journal: No space left on device
Failed to write entry of 2 bytes: No space left on device
sd_journal_open_files(["/tmp/fuzz-journal-remote.vELRpI.journal"]) failed: No data available
Assertion 'IN_SET(r, -ENOMEM, -EMFILE, -ENFILE)' failed at src/journal-remote/fuzz-journal-remote.c:70, function int LLVMFuzzerTestOneInput(const uint8_t *, size_t)(). Aborting.

oss-fuzz-39238: https://oss-fuzz.com/issue/4609851129462784
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2022-05-08 11:18:14 +02:00
parent 44468876c3
commit 40893cbfd5

View File

@ -66,7 +66,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
r = sd_journal_open_files(&j, (const char**) STRV_MAKE(name), 0); r = sd_journal_open_files(&j, (const char**) STRV_MAKE(name), 0);
if (r < 0) { if (r < 0) {
log_error_errno(r, "sd_journal_open_files([\"%s\"]) failed: %m", name); log_error_errno(r, "sd_journal_open_files([\"%s\"]) failed: %m", name);
assert_se(IN_SET(r, -ENOMEM, -EMFILE, -ENFILE)); assert_se(IN_SET(r, -ENOMEM, -EMFILE, -ENFILE, -ENODATA));
return r; return r;
} }