]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
fuzz: limit the size of the input
authorFrantisek Sumsal <frantisek@sumsal.cz>
Wed, 1 Nov 2023 19:18:28 +0000 (20:18 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Wed, 1 Nov 2023 23:08:19 +0000 (23:08 +0000)
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

src/core/fuzz-execute-serialize.c

index 862b525974ba461e13496c520f63e1dfa0f2c369..6069efd519f61c6caf92fa07eed11a533736e7c0 100644 (file)
@@ -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());