fuzz-journal-stream: avoid assertion failure on samples which don't fit in pipe
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 26 Feb 2019 12:00:35 +0000 (13:00 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 26 Feb 2019 12:00:35 +0000 (13:00 +0100)
commiteafadd069c4e30ed62173123326a7237448615d1
treed9147d59505b059731b57226293a53adc4c08aa9
parentd26eef9252677bfe06ed76eedc11db3001283814
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.
src/fuzz/fuzz-journald-stream.c
src/fuzz/fuzz-journald-stream.options [new file with mode: 0644]