mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-08 21:17:47 +03:00
fuzz-journal-stream: avoid assertion failure on samples which don't fit in pipe
Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=11587. We had a sample which was large enough that write(2) failed to push all the data into the pipe, and an assert failed. The code could be changed to use a loop, but then we'd need to interleave writes and sd_event_run (to process the journal). I don't think the complexity is worth it — fuzzing works best if the sample is not too huge anyway. So let's just reject samples above 64k, and tell oss-fuzz about this limit.
This commit is contained in:
parent
d26eef9252
commit
eafadd069c
@ -15,7 +15,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
StdoutStream *stream;
|
||||
int v;
|
||||
|
||||
if (size == 0)
|
||||
if (size == 0 || size > 65536)
|
||||
return 0;
|
||||
|
||||
if (!getenv("SYSTEMD_LOG_LEVEL"))
|
||||
|
2
src/fuzz/fuzz-journald-stream.options
Normal file
2
src/fuzz/fuzz-journald-stream.options
Normal file
@ -0,0 +1,2 @@
|
||||
[libfuzzer]
|
||||
max_len = 65536
|
Loading…
Reference in New Issue
Block a user