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.
This commit is contained in:
Renata Hodovan 2025-04-10 23:09:15 +02:00
parent ecfef7174d
commit f5788c7b67

View File

@ -16,6 +16,7 @@
#include "libregexp.h"
#include "quickjs-libc.h"
static int nbinterrupts = 0;
int lre_check_stack_overflow(void *opaque, size_t alloca_size) { return 0; }
@ -24,6 +25,12 @@ void *lre_realloc(void *opaque, void *ptr, size_t size)
return realloc(ptr, size);
}
int lre_check_timeout(void *opaque)
{
nbinterrupts++;
return (nbinterrupts > 100);
}
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
int len, ret, i;
uint8_t *bc;