summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrantisek Sumsal <frantisek@sumsal.cz>2023-11-01 20:18:28 +0100
committerLuca Boccassi <luca.boccassi@gmail.com>2023-11-02 00:08:19 +0100
commitd0404391e5f87a892c2eaed3a89028281af34f6b (patch)
treec4837fecf8d3c3a32c2797e7abf3a5038404c63a
parentNEWS: more typo fixes (diff)
downloadsystemd-d0404391e5f87a892c2eaed3a89028281af34f6b.tar.xz
systemd-d0404391e5f87a892c2eaed3a89028281af34f6b.zip
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
-rw-r--r--src/core/fuzz-execute-serialize.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/core/fuzz-execute-serialize.c b/src/core/fuzz-execute-serialize.c
index 862b525974..6069efd519 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());