Skip to content

Commit 39dbf50

Browse files
authored
fuzz: limit input length (#238)
Longer inputs can lead to timeouts on oss-fuzz
1 parent f0b3707 commit 39dbf50

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

test/fuzzer.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
55
{
66
if(size < 1) return 0;
77

8+
/* Avoid timeout with long inputs */
9+
if(size > (64 * 1024)) return 0;
10+
811
if(data[size-1] != '\0') return 0;
912

1013
const uint8_t* ptr = data;
@@ -54,7 +57,7 @@ int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size)
5457
options = UTF8PROC_STRIPCC;
5558
memcpy(copy, data, size);
5659
utf8proc_normalize_utf32(copy, size, options);
57-
60+
5861
options = 0;
5962
memcpy(copy, data, size);
6063
utf8proc_normalize_utf32(copy, size, options);

0 commit comments

Comments
 (0)