Skip to content

Commit 9de4f87

Browse files
committed
Limit parse depth in mbstring fuzzer
The default depth of 4096 is large enough to cause optimize_node stack overflows under asan. Reduce to 1024.
1 parent a40a69f commit 9de4f87

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

sapi/fuzzer/fuzzer-mbstring.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include "Zend/zend.h"
2121
#include "main/php_config.h"
2222
#include "main/php_main.h"
23+
#include "oniguruma.h"
2324

2425
#include <stdio.h>
2526
#include <stdint.h>
@@ -67,6 +68,9 @@ int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
6768
int LLVMFuzzerInitialize(int *argc, char ***argv) {
6869
fuzzer_init_php();
6970

71+
/* The default parse depth limit allows stack overflows under asan. */
72+
onig_set_parse_depth_limit(1024);
73+
7074
/* fuzzer_shutdown_php(); */
7175
return 0;
7276
}

0 commit comments

Comments
 (0)