summaryrefslogtreecommitdiff
path: root/src/journal-remote/fuzz-journal-remote.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-05-08 11:18:14 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2022-05-08 22:47:50 +0200
commit40893cbfd5db8b2213c1f4e8047bef224d2258cc (patch)
treee618c2fa057aea0516f440da3d5576a0a5e0856e /src/journal-remote/fuzz-journal-remote.c
parent44468876c37e01efe2d9fe1b170d19d8b6958373 (diff)
downloadsystemd-40893cbfd5db8b2213c1f4e8047bef224d2258cc.tar.gz
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
Diffstat (limited to 'src/journal-remote/fuzz-journal-remote.c')
-rw-r--r--src/journal-remote/fuzz-journal-remote.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/journal-remote/fuzz-journal-remote.c b/src/journal-remote/fuzz-journal-remote.c
index 9206b99406..a8e56e21b2 100644
--- a/src/journal-remote/fuzz-journal-remote.c
+++ b/src/journal-remote/fuzz-journal-remote.c
@@ -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);
if (r < 0) {
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;
}