Make fuzz support abort on internal errors.
This commit is contained in:
parent
4c69f50e69
commit
6962217441
|
@ -81,8 +81,8 @@ for (i = 0; i < 2; i++)
|
||||||
pcre2_code *code;
|
pcre2_code *code;
|
||||||
|
|
||||||
#ifdef STANDALONE
|
#ifdef STANDALONE
|
||||||
printf("Compile with options %.8x", compile_options);
|
printf("Compile options %.8x never_backslash_c", compile_options);
|
||||||
printf("%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
|
printf("%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s\n",
|
||||||
((compile_options & PCRE2_ALT_BSUX) != 0)? ",alt_bsux" : "",
|
((compile_options & PCRE2_ALT_BSUX) != 0)? ",alt_bsux" : "",
|
||||||
((compile_options & PCRE2_ALT_CIRCUMFLEX) != 0)? ",alt_circumflex" : "",
|
((compile_options & PCRE2_ALT_CIRCUMFLEX) != 0)? ",alt_circumflex" : "",
|
||||||
((compile_options & PCRE2_ALT_VERBNAMES) != 0)? ",alt_verbnames" : "",
|
((compile_options & PCRE2_ALT_VERBNAMES) != 0)? ",alt_verbnames" : "",
|
||||||
|
@ -97,7 +97,6 @@ for (i = 0; i < 2; i++)
|
||||||
((compile_options & PCRE2_FIRSTLINE) != 0)? ",firstline" : "",
|
((compile_options & PCRE2_FIRSTLINE) != 0)? ",firstline" : "",
|
||||||
((compile_options & PCRE2_MATCH_UNSET_BACKREF) != 0)? ",match_unset_backref" : "",
|
((compile_options & PCRE2_MATCH_UNSET_BACKREF) != 0)? ",match_unset_backref" : "",
|
||||||
((compile_options & PCRE2_MULTILINE) != 0)? ",multiline" : "",
|
((compile_options & PCRE2_MULTILINE) != 0)? ",multiline" : "",
|
||||||
((compile_options & PCRE2_NEVER_BACKSLASH_C) != 0)? ",never_backslash_c" : "",
|
|
||||||
((compile_options & PCRE2_NEVER_UCP) != 0)? ",never_ucp" : "",
|
((compile_options & PCRE2_NEVER_UCP) != 0)? ",never_ucp" : "",
|
||||||
((compile_options & PCRE2_NEVER_UTF) != 0)? ",never_utf" : "",
|
((compile_options & PCRE2_NEVER_UTF) != 0)? ",never_utf" : "",
|
||||||
((compile_options & PCRE2_NO_AUTO_CAPTURE) != 0)? ",no_auto_capture" : "",
|
((compile_options & PCRE2_NO_AUTO_CAPTURE) != 0)? ",no_auto_capture" : "",
|
||||||
|
@ -113,6 +112,8 @@ for (i = 0; i < 2; i++)
|
||||||
|
|
||||||
code = pcre2_compile((PCRE2_SPTR)data, (PCRE2_SIZE)size, compile_options,
|
code = pcre2_compile((PCRE2_SPTR)data, (PCRE2_SIZE)size, compile_options,
|
||||||
&errorcode, &erroroffset, NULL);
|
&errorcode, &erroroffset, NULL);
|
||||||
|
|
||||||
|
/* Compilation succeeded */
|
||||||
|
|
||||||
if (code != NULL)
|
if (code != NULL)
|
||||||
{
|
{
|
||||||
|
@ -168,16 +169,19 @@ for (i = 0; i < 2; i++)
|
||||||
match_options = save_match_options; /* Reset for the second compile */
|
match_options = save_match_options; /* Reset for the second compile */
|
||||||
pcre2_code_free(code);
|
pcre2_code_free(code);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Compilation failed */
|
||||||
|
|
||||||
#ifdef STANDALONE
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unsigned char buffer[256];
|
unsigned char buffer[256];
|
||||||
pcre2_get_error_message(errorcode, buffer, 256);
|
pcre2_get_error_message(errorcode, buffer, 256);
|
||||||
printf("Compile failed: error %d at offset %lu: %s\n", errorcode,
|
#ifdef STANDALONE
|
||||||
erroroffset, buffer);
|
printf("Error %d at offset %lu: %s\n", errorcode, erroroffset, buffer);
|
||||||
}
|
#else
|
||||||
|
if (strstr((const char *)buffer, "internal error") != NULL) abort();
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
compile_options = PCRE2_NEVER_BACKSLASH_C; /* For second time */
|
compile_options = PCRE2_NEVER_BACKSLASH_C; /* For second time */
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue