mirror of
https://github.com/bellard/quickjs.git
synced 2025-05-11 10:54:20 +08:00
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:
parent
ecfef7174d
commit
f5788c7b67
@ -16,6 +16,7 @@
|
|||||||
#include "libregexp.h"
|
#include "libregexp.h"
|
||||||
#include "quickjs-libc.h"
|
#include "quickjs-libc.h"
|
||||||
|
|
||||||
|
static int nbinterrupts = 0;
|
||||||
|
|
||||||
int lre_check_stack_overflow(void *opaque, size_t alloca_size) { return 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);
|
return realloc(ptr, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int lre_check_timeout(void *opaque)
|
||||||
|
{
|
||||||
|
nbinterrupts++;
|
||||||
|
return (nbinterrupts > 100);
|
||||||
|
}
|
||||||
|
|
||||||
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||||
int len, ret, i;
|
int len, ret, i;
|
||||||
uint8_t *bc;
|
uint8_t *bc;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user