Screw down the depth limit for DFA matching in the fuzzer function. Fixes

OSS-fuzz 1761 (I hope).
This commit is contained in:
Philip.Hazel 2017-05-22 18:06:55 +00:00
parent e36e582af0
commit 0e622185c2
1 changed files with 7 additions and 4 deletions

View File

@ -172,11 +172,12 @@ for (i = 0; i < 2; i++)
return 0; return 0;
} }
(void)pcre2_set_match_limit(match_context, 100); (void)pcre2_set_match_limit(match_context, 100);
(void)pcre2_set_depth_limit(match_context, 100);
(void)pcre2_set_callout(match_context, callout_function, &callout_count); (void)pcre2_set_callout(match_context, callout_function, &callout_count);
} }
/* Match twice, with and without options */ /* Match twice, with and without options, with a depth limit of 100. */
(void)pcre2_set_depth_limit(match_context, 100);
for (j = 0; j < 2; j++) for (j = 0; j < 2; j++)
{ {
@ -210,9 +211,11 @@ for (i = 0; i < 2; i++)
match_options = 0; /* For second time */ match_options = 0; /* For second time */
} }
/* Match with DFA twice, with and without options */ /* Match with DFA twice, with and without options, depth limit of 10. */
(void)pcre2_set_depth_limit(match_context, 10);
match_options = save_match_options & ~PCRE2_NO_JIT; /* Not valid for DFA */
match_options = save_match_options & ~PCRE2_NO_JIT;
for (j = 0; j < 2; j++) for (j = 0; j < 2; j++)
{ {
#ifdef STANDALONE #ifdef STANDALONE