Skip to content

Commit 7e34f7e

Browse files
committed
disable recursion checks in interpreter when fuzzing
1 parent 4bf94eb commit 7e34f7e

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

configure.ac

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -530,9 +530,14 @@ AM_CONDITIONAL(WITH_UNICODE, test "x$enable_unicode" = "xyes")
530530
AM_CONDITIONAL(WITH_VALGRIND, test "x$enable_valgrind" = "xyes")
531531
AM_CONDITIONAL(WITH_FUZZ_SUPPORT, test "x$enable_fuzz_support" = "xyes")
532532

533-
if test "$enable_fuzz_support" = "yes" -a "$enable_pcre2_8" = "no"; then
534-
echo "** ERROR: Fuzzer support requires the 8-bit library"
535-
exit 1
533+
if test "$enable_fuzz_support" = "yes"; then
534+
if test "$enable_pcre2_8" = "no"; then
535+
echo "** ERROR: Fuzzer support requires the 8-bit library"
536+
exit 1
537+
fi
538+
AC_DEFINE([SUPPORT_FUZZ], [], [
539+
Define to any value to enable support for fuzzing, which adjusts some
540+
behaviours for consistency between JIT and interpreter.])
536541
fi
537542

538543
# Checks for typedefs, structures, and compiler characteristics.

src/config.h.in

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,10 @@ sure both macros are undefined; an emulation function will then be used. */
292292
backward compatibility; new code need not use it. */
293293
#undef STDC_HEADERS
294294

295+
/* Define to any value to enable support for fuzzing, which adjusts some
296+
behaviours for consistency between JIT and interpreter. */
297+
#undef SUPPORT_FUZZ
298+
295299
/* Define to any value to enable support for Just-In-Time compiling. */
296300
#undef SUPPORT_JIT
297301

src/pcre2_match.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5441,8 +5441,10 @@ fprintf(stderr, "++ %2ld op=%3d %s\n", Fecode - mb->start_code, *Fecode,
54415441
P = (heapframe *)((char *)N - frame_size);
54425442
if (N->group_frame_type == (GF_RECURSE | number))
54435443
{
5444+
#ifndef SUPPORT_FUZZ
54445445
if (Feptr == P->eptr && mb->last_used_ptr == P->recurse_last_used)
54455446
return PCRE2_ERROR_RECURSELOOP;
5447+
#endif // SUPPORT_FUZZ
54465448
break;
54475449
}
54485450
offset = P->last_group_offset;

0 commit comments

Comments
 (0)