Skip to content

Commit 40aa6b6

Browse files
committed
Further limit max input size in parser fuzzer
It's easy to cause stack overflows with degenerate cases like "$$$$$x" repeated thousands of times. We have no interest in addressing these. Make the input size smaller to hopefully avoid these stack overflows.
1 parent 982b149 commit 40aa6b6

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

sapi/fuzzer/fuzzer-parser.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@
2626
#include "fuzzer-sapi.h"
2727

2828
int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
29-
if (Size > 32 * 1024) {
30-
/* Large inputs have a large impact on fuzzer performance,
29+
if (Size > 7 * 1024) {
30+
/* Large inputs have a large impact on fuzzer performance and may cause stack overflows,
3131
* but are unlikely to be necessary to reach new codepaths. */
3232
return 0;
3333
}

sapi/fuzzer/generate_parser_corpus.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
$corpusDir = __DIR__ . '/corpus/parser';
1010
@mkdir($corpusDir);
1111

12-
$maxLen = 32 * 1024;
12+
$maxLen = 7 * 1024;
1313
foreach ($it as $file) {
1414
if (!preg_match('/\.phpt$/', $file)) continue;
1515
$code = file_get_contents($file);

0 commit comments

Comments
 (0)