From: Zbigniew Jędrzejewski-Szmek Date: Tue, 26 Feb 2019 12:12:53 +0000 (+0100) Subject: fuzz-ndisc-rs: avoid assertion failure on samples which dont fit in pipe X-Git-Tag: v242-rc1~240^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F11824%2Fhead;p=thirdparty%2Fsystemd.git fuzz-ndisc-rs: avoid assertion failure on samples which dont fit in pipe Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=11605. --- diff --git a/src/fuzz/fuzz-ndisc-rs.c b/src/fuzz/fuzz-ndisc-rs.c index 3a1e60fc5dd..d8d256d1271 100644 --- a/src/fuzz/fuzz-ndisc-rs.c +++ b/src/fuzz/fuzz-ndisc-rs.c @@ -43,6 +43,9 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { _cleanup_(sd_event_unrefp) sd_event *e = NULL; _cleanup_(sd_ndisc_unrefp) sd_ndisc *nd = NULL; + if (size > 2048) + return 0; + assert_se(sd_event_new(&e) >= 0); assert_se(sd_ndisc_new(&nd) >= 0); assert_se(sd_ndisc_attach_event(nd, e, 0) >= 0); diff --git a/src/fuzz/fuzz-ndisc-rs.options b/src/fuzz/fuzz-ndisc-rs.options new file mode 100644 index 00000000000..60bd9b0b2fa --- /dev/null +++ b/src/fuzz/fuzz-ndisc-rs.options @@ -0,0 +1,2 @@ +[libfuzzer] +max_len = 2048