]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
fuzz-bootspec: limit input size
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 10 May 2022 09:55:37 +0000 (11:55 +0200)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Tue, 10 May 2022 17:12:35 +0000 (02:12 +0900)
https://oss-fuzz.com/testcase-detail/5680508182331392 has the
first timeout with 811kb of input. As in the other cases, the code
is known to be slow with lots of repeated entries and we're fine with
that.

src/fuzz/fuzz-bootspec.c
src/fuzz/fuzz-bootspec.options [new file with mode: 0644]

index b59e67c24e39b75de071a79c2e7893e3275cca1b..fa9e3f06e04dac4ca284fc70fb67e34b578d7f87 100644 (file)
@@ -84,6 +84,9 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
         _cleanup_(boot_config_free) BootConfig config = BOOT_CONFIG_NULL;
         int r;
 
+        if (size > 65535)
+                return 0;
+
         /* Disable most logging if not running standalone */
         if (!getenv("SYSTEMD_LOG_LEVEL"))
                 log_set_max_level(LOG_CRIT);
diff --git a/src/fuzz/fuzz-bootspec.options b/src/fuzz/fuzz-bootspec.options
new file mode 100644 (file)
index 0000000..0824b19
--- /dev/null
@@ -0,0 +1,2 @@
+[libfuzzer]
+max_len = 65535