Discard partial match when endanchored is set in the fuzzer, as it just gives

an immediate bad options return.
This commit is contained in:
Philip.Hazel 2017-05-27 16:06:56 +00:00
parent 3f96e07e6b
commit 62e202f757
2 changed files with 8 additions and 3 deletions

View File

@ -42,7 +42,6 @@ bugs were never in fully released code, but are noted here for the record.
(g) Similarly refactor the way the variable length ovector is addressed for (g) Similarly refactor the way the variable length ovector is addressed for
similar reasons. Fixes oss-fuzz issue 1465. similar reasons. Fixes oss-fuzz issue 1465.
2. Now that pcre2_match() no longer uses recursive function calls (see above), 2. Now that pcre2_match() no longer uses recursive function calls (see above),
the "match limit recursion" value seems misnamed. It still exists, and limits the "match limit recursion" value seems misnamed. It still exists, and limits
the depth of tree that is searched. To avoid future confusion, it has been the depth of tree that is searched. To avoid future confusion, it has been

View File

@ -94,6 +94,12 @@ compile_options =
match_options = match_options =
((((uint32_t)r1 << 16) | ((uint32_t)r2 & 0xffff)) & ALLOWED_MATCH_OPTIONS); ((((uint32_t)r1 << 16) | ((uint32_t)r2 & 0xffff)) & ALLOWED_MATCH_OPTIONS);
/* Discard partial matching if PCRE2_ENDANCHORED is set, because they are not
allowed together and just give an immediate error return. */
if (((compile_options|match_options) & PCRE2_ENDANCHORED) != 0)
match_options &= ~(PCRE2_PARTIAL_HARD|PCRE2_PARTIAL_SOFT);
/* Do the compile with and without the options, and after a successful compile, /* Do the compile with and without the options, and after a successful compile,
likewise do the match with and without the options. */ likewise do the match with and without the options. */