From: Frantisek Sumsal Date: Wed, 1 Nov 2023 19:18:28 +0000 (+0100) Subject: fuzz: limit the size of the input X-Git-Tag: v255-rc1~48 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=d0404391e5f87a892c2eaed3a89028281af34f6b;p=thirdparty%2Fsystemd.git fuzz: limit the size of the input To avoid timeouts in oss-fuzz. The timeout reported in #29736 happened with a ~500K test case, so with a conservative 128K limit we should still be well within a range for any reasonable-ish generated input to get through, while avoiding timeouts. Resolves: #29736 --- diff --git a/src/core/fuzz-execute-serialize.c b/src/core/fuzz-execute-serialize.c index 862b525974b..6069efd519f 100644 --- a/src/core/fuzz-execute-serialize.c +++ b/src/core/fuzz-execute-serialize.c @@ -75,6 +75,9 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { _cleanup_fclose_ FILE *f = NULL; _cleanup_fdset_free_ FDSet *fdset = NULL; + if (outside_size_range(size, 0, 128 * 1024)) + return 0; + fuzz_setup_logging(); assert_se(fdset = fdset_new());