Fix \Q...\E bug in (*VERB) name when PCRE2_ALT_VERBNAMES and PCRE2_AUTO_CALLOUT

were both specified.
This commit is contained in:
ph10 2016-11-27 16:14:33 +00:00
parent 014fd3c2ac
commit 3a1c44b95d
4 changed files with 11 additions and 3 deletions

View File

@ -51,7 +51,8 @@ longer inserted before and after explicit callouts in the pattern.
Some bugs in the refactored code were subsequently fixed before release.
Several of them were related to the change from assuming a zero-terminated
pattern (which previously had required non-zero terminated strings to be
copied).
copied). These bugs were never in released code, but are noted here for the
record, once the code was made available in the repository.
(a) An overall recursion such as (?0) inside a lookbehind assertion was not
being diagnosed as an error.
@ -97,6 +98,9 @@ copied).
the called subroutine in the parsed pattern.
(m) Quantifiers following (*VERB)s were not being diagnosed as errors.
(n) The use of \Q...\E in a (*VERB) name when PCRE2_ALT_VERBNAMES and
PCRE2_AUTO_CALLOUT were both specified caused undetermined behaviour.
4. Back references are now permitted in lookbehind assertions when there are
no duplicated group numbers (that is, (?| has not been used), and, if the

View File

@ -2312,7 +2312,7 @@ while (ptr < ptrend)
GETCHARINCTEST(c, ptr);
/* Copy quoted literals until \E, allowing for the possibility of automatic
callouts. */
callouts, except when processing a (*VERB) "name". */
if (inescq)
{
@ -2323,7 +2323,7 @@ while (ptr < ptrend)
}
else
{
if (after_manual_callout-- <= 0)
if (!inverbname && after_manual_callout-- <= 0)
parsed_pattern = manage_callouts(thisptr, &previous_callout, options,
parsed_pattern, cb);
PARSED_LITERAL(c, parsed_pattern);

2
testdata/testinput2 vendored
View File

@ -4920,4 +4920,6 @@ a)"xI
/(*:ab)*/
%(*:(:(svvvvvvvvvv:]*[ Z!*;[]*[^[]*!^[+.+{{2,7}' _\\\\\\\\\\\\\)?.:.. *w////\\\Q\\\\\\\\\\\\\\\T\\\\\+/?/////'+\\\EEE?/////'+/*+/[^K]?]//(w)%never_backslash_c,alt_verbnames,auto_callout
# End of testinput2

View File

@ -15372,6 +15372,8 @@ Failed: error 128 at offset 2: assertion expected after (?( or (?(?C)
/(*:ab)*/
Failed: error 109 at offset 6: quantifier does not follow a repeatable item
%(*:(:(svvvvvvvvvv:]*[ Z!*;[]*[^[]*!^[+.+{{2,7}' _\\\\\\\\\\\\\)?.:.. *w////\\\Q\\\\\\\\\\\\\\\T\\\\\+/?/////'+\\\EEE?/////'+/*+/[^K]?]//(w)%never_backslash_c,alt_verbnames,auto_callout
# End of testinput2
Error -63: PCRE2_ERROR_BADDATA (unknown error number)
Error -62: bad serialized data