Skip to content

Commit

Permalink
Add more tracing info to fuzz support when run in standalone mode
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilipHazel committed Feb 23, 2024
1 parent acd6d31 commit 409d8e6
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion src/pcre2_fuzzsupport.c
Original file line number Diff line number Diff line change
Expand Up @@ -393,17 +393,40 @@ for (i = 0; i < 2; i++)
}
#endif

/* If JIT is enabled, do a JIT match and, if appropriately compiled, compare
with the interpreter. */

#ifdef SUPPORT_JIT
if (jit_ret >= 0)
{
#ifdef STANDALONE
printf("Matching with JIT\n");
#endif
callout_count = 0;
errorcode_jit = pcre2_match(code, (PCRE2_SPTR)data, (PCRE2_SIZE)match_size, 0,
match_options & ~PCRE2_NO_JIT, match_data_jit, match_context);

/* Without differential matching, just show the result when standalone. */

#ifndef SUPPORT_DIFF_FUZZ
(void)errorcode_jit; /* Avoid compiler warning */
#ifdef STANDALONE
if (errorcode_jit >= 0) printf("Match returned %d\n", errorcode_jit); else
{
#if PCRE2_CODE_UNIT_WIDTH == 8
unsigned char buffer[256];
pcre2_get_error_message(errorcode_jit, buffer, 256);
printf("JIT match failed: error %d: %s\n", errorcode_jit, buffer);
#else
printf("JIT match failed: error %d\n", errorcode_jit);
#endif
}
#else /* not STANDALONE */
(void)errorcode_jit; /* Avoid compiler warning */
#endif /* STANDALONE */

/* With differential matching enabled, compare with interpreter. */

#else /* SUPPORT_DIFF_FUZZ */
matches = errorcode;
matches_jit = errorcode_jit;

Expand Down

0 comments on commit 409d8e6

Please sign in to comment.