Browse Source
fuzz: limit input length (#238)
Longer inputs can lead to timeouts on oss-fuzz
pull/239/head
Randy
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
4 additions and
1 deletions
-
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; |
|
|
|