Add a call to pcre2_dfa_match() to the fuzzer driver.
This commit is contained in:
parent
cfd8c7c56a
commit
58bd4aa3cc
@ -19,6 +19,8 @@ Written by Philip Hazel, October 2016
|
|||||||
|
|
||||||
#define MAX_MATCH_SIZE 1000
|
#define MAX_MATCH_SIZE 1000
|
||||||
|
|
||||||
|
#define DFA_WORKSPACE_COUNT 100
|
||||||
|
|
||||||
#define ALLOWED_COMPILE_OPTIONS \
|
#define ALLOWED_COMPILE_OPTIONS \
|
||||||
(PCRE2_ANCHORED|PCRE2_ALLOW_EMPTY_CLASS|PCRE2_ALT_BSUX|PCRE2_ALT_CIRCUMFLEX| \
|
(PCRE2_ANCHORED|PCRE2_ALLOW_EMPTY_CLASS|PCRE2_ALT_BSUX|PCRE2_ALT_CIRCUMFLEX| \
|
||||||
PCRE2_ALT_VERBNAMES|PCRE2_AUTO_CALLOUT|PCRE2_CASELESS|PCRE2_DOLLAR_ENDONLY| \
|
PCRE2_ALT_VERBNAMES|PCRE2_AUTO_CALLOUT|PCRE2_CASELESS|PCRE2_DOLLAR_ENDONLY| \
|
||||||
@ -59,6 +61,7 @@ uint32_t match_options;
|
|||||||
pcre2_match_data *match_data = NULL;
|
pcre2_match_data *match_data = NULL;
|
||||||
pcre2_match_context *match_context = NULL;
|
pcre2_match_context *match_context = NULL;
|
||||||
size_t match_size;
|
size_t match_size;
|
||||||
|
int dfa_workspace[DFA_WORKSPACE_COUNT];
|
||||||
int r1, r2;
|
int r1, r2;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -195,6 +198,42 @@ for (i = 0; i < 2; i++)
|
|||||||
errorcode = pcre2_match(code, (PCRE2_SPTR)data, (PCRE2_SIZE)match_size, 0,
|
errorcode = pcre2_match(code, (PCRE2_SPTR)data, (PCRE2_SIZE)match_size, 0,
|
||||||
match_options, match_data, match_context);
|
match_options, match_data, match_context);
|
||||||
|
|
||||||
|
#ifdef STANDALONE
|
||||||
|
if (errorcode >= 0) printf("Match returned %d\n", errorcode); else
|
||||||
|
{
|
||||||
|
unsigned char buffer[256];
|
||||||
|
pcre2_get_error_message(errorcode, buffer, 256);
|
||||||
|
printf("Match failed: error %d: %s\n", errorcode, buffer);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
match_options = 0; /* For second time */
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Match with DFA twice, with and without options */
|
||||||
|
|
||||||
|
match_options = save_match_options & ~PCRE2_NO_JIT;
|
||||||
|
for (j = 0; j < 2; j++)
|
||||||
|
{
|
||||||
|
#ifdef STANDALONE
|
||||||
|
printf("DFA match options %.8x", match_options);
|
||||||
|
printf("%s%s%s%s%s%s%s%s%s\n",
|
||||||
|
((match_options & PCRE2_ANCHORED) != 0)? ",anchored" : "",
|
||||||
|
((match_options & PCRE2_ENDANCHORED) != 0)? ",endanchored" : "",
|
||||||
|
((match_options & PCRE2_NO_UTF_CHECK) != 0)? ",no_utf_check" : "",
|
||||||
|
((match_options & PCRE2_NOTBOL) != 0)? ",notbol" : "",
|
||||||
|
((match_options & PCRE2_NOTEMPTY) != 0)? ",notempty" : "",
|
||||||
|
((match_options & PCRE2_NOTEMPTY_ATSTART) != 0)? ",notempty_atstart" : "",
|
||||||
|
((match_options & PCRE2_NOTEOL) != 0)? ",noteol" : "",
|
||||||
|
((match_options & PCRE2_PARTIAL_HARD) != 0)? ",partial_hard" : "",
|
||||||
|
((match_options & PCRE2_PARTIAL_SOFT) != 0)? ",partial_soft" : "");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
callout_count = 0;
|
||||||
|
errorcode = pcre2_dfa_match(code, (PCRE2_SPTR)data,
|
||||||
|
(PCRE2_SIZE)match_size, 0, match_options, match_data, match_context,
|
||||||
|
dfa_workspace, DFA_WORKSPACE_COUNT);
|
||||||
|
|
||||||
#ifdef STANDALONE
|
#ifdef STANDALONE
|
||||||
if (errorcode >= 0) printf("Match returned %d\n", errorcode); else
|
if (errorcode >= 0) printf("Match returned %d\n", errorcode); else
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user