diff --git a/configure.ac b/configure.ac index 5676525e2..214cecdd7 100644 --- a/configure.ac +++ b/configure.ac @@ -530,9 +530,14 @@ AM_CONDITIONAL(WITH_UNICODE, test "x$enable_unicode" = "xyes") AM_CONDITIONAL(WITH_VALGRIND, test "x$enable_valgrind" = "xyes") AM_CONDITIONAL(WITH_FUZZ_SUPPORT, test "x$enable_fuzz_support" = "xyes") -if test "$enable_fuzz_support" = "yes" -a "$enable_pcre2_8" = "no"; then - echo "** ERROR: Fuzzer support requires the 8-bit library" - exit 1 +if test "$enable_fuzz_support" = "yes"; then + if test "$enable_pcre2_8" = "no"; then + echo "** ERROR: Fuzzer support requires the 8-bit library" + exit 1 + fi + AC_DEFINE([SUPPORT_FUZZ], [], [ + Define to any value to enable support for fuzzing, which adjusts some + behaviours for consistency between JIT and interpreter.]) fi # Checks for typedefs, structures, and compiler characteristics. diff --git a/src/config.h.in b/src/config.h.in index b19cc64cf..181091512 100644 --- a/src/config.h.in +++ b/src/config.h.in @@ -292,6 +292,10 @@ sure both macros are undefined; an emulation function will then be used. */ backward compatibility; new code need not use it. */ #undef STDC_HEADERS +/* Define to any value to enable support for fuzzing, which adjusts some + behaviours for consistency between JIT and interpreter. */ +#undef SUPPORT_FUZZ + /* Define to any value to enable support for Just-In-Time compiling. */ #undef SUPPORT_JIT diff --git a/src/pcre2_match.c b/src/pcre2_match.c index b2e1f23bd..c99be2bcd 100644 --- a/src/pcre2_match.c +++ b/src/pcre2_match.c @@ -5441,8 +5441,10 @@ fprintf(stderr, "++ %2ld op=%3d %s\n", Fecode - mb->start_code, *Fecode, P = (heapframe *)((char *)N - frame_size); if (N->group_frame_type == (GF_RECURSE | number)) { +#ifndef SUPPORT_FUZZ if (Feptr == P->eptr && mb->last_used_ptr == P->recurse_last_used) return PCRE2_ERROR_RECURSELOOP; +#endif // SUPPORT_FUZZ break; } offset = P->last_group_offset;