Skip to content

Commit f5788c7

Browse files
committed
Define lre_check_timeout in fuzz_regexp
Since #25aaa77, lre_check_timeout must be defined by the user. The patch adds this definition to the regexp fuzzer.
1 parent ecfef71 commit f5788c7

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

fuzz/fuzz_regexp.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#include "libregexp.h"
1717
#include "quickjs-libc.h"
1818

19+
static int nbinterrupts = 0;
1920

2021
int lre_check_stack_overflow(void *opaque, size_t alloca_size) { return 0; }
2122

@@ -24,6 +25,12 @@ void *lre_realloc(void *opaque, void *ptr, size_t size)
2425
return realloc(ptr, size);
2526
}
2627

28+
int lre_check_timeout(void *opaque)
29+
{
30+
nbinterrupts++;
31+
return (nbinterrupts > 100);
32+
}
33+
2734
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
2835
int len, ret, i;
2936
uint8_t *bc;

0 commit comments

Comments
 (0)