From: Randy Date: Fri, 6 May 2022 01:49:11 +0000 (+0200) Subject: fuzz: limit input length (#238) X-Git-Tag: archive/raspbian/2.11.3-2+rpi1^2~10^2~1^2~30 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=39dbf507d72994939a8bee2b706e26440f9bc60c;p=utf8proc.git fuzz: limit input length (#238) Longer inputs can lead to timeouts on oss-fuzz --- diff --git a/test/fuzzer.c b/test/fuzzer.c index 1e02f33..15007c9 100644 --- a/test/fuzzer.c +++ b/test/fuzzer.c @@ -5,6 +5,9 @@ int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { if(size < 1) return 0; + /* Avoid timeout with long inputs */ + if(size > (64 * 1024)) return 0; + if(data[size-1] != '\0') return 0; const uint8_t* ptr = data; @@ -54,7 +57,7 @@ int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) options = UTF8PROC_STRIPCC; memcpy(copy, data, size); utf8proc_normalize_utf32(copy, size, options); - + options = 0; memcpy(copy, data, size); utf8proc_normalize_utf32(copy, size, options);