Fix issue with \Q\E after a callout before an assertion condition.

This commit is contained in:
Philip.Hazel 2016-12-28 12:26:12 +00:00
parent fdf7946ee0
commit f676362977
4 changed files with 26 additions and 8 deletions

View File

@ -42,6 +42,9 @@ some minor bugs and Perl incompatibilities were fixed, including:
/[[:ascii:]-z]/) now generates an error. Perl does accept this as a
literal, but gives a warning, so it seems best to fail it in PCRE.
(h) An empty \Q\E sequence may appear after a callout that precedes an
assertion condition (it is, of course, ignored).
One effect of the refactoring is that some error numbers and messages have
changed, and the pattern offset given for compiling errors is not always the
right-most character that has been read. In particular, for a variable-length

View File

@ -2321,6 +2321,12 @@ while (ptr < ptrend)
}
else
{
if (expect_cond_assert > 0) /* A literal is not allowed if we are */
{ /* expecting a conditional assertion, */
ptr--; /* but an empty \Q\E sequence is OK. */
errorcode = ERR28;
goto FAILED;
}
if (!inverbname && after_manual_callout-- <= 0)
parsed_pattern = manage_callouts(thisptr, &previous_callout, options,
parsed_pattern, cb);

4
testdata/testinput2 vendored
View File

@ -4952,4 +4952,8 @@ a)"xI
/[:[:alnum:]-[[a:lnum:]+/
/((?(?C'')\QX\E(?!((?(?C'')(?!X=X));=)r*X=X));=)/
/((?(?C'')\Q\E(?!((?(?C'')(?!X=X));=)r*X=X));=)/
# End of testinput2

View File

@ -15434,6 +15434,11 @@ Failed: error 128 at offset 63: assertion expected after (?( or (?(?C)
/[:[:alnum:]-[[a:lnum:]+/
Failed: error 150 at offset 11: invalid range in character class
/((?(?C'')\QX\E(?!((?(?C'')(?!X=X));=)r*X=X));=)/
Failed: error 128 at offset 11: assertion expected after (?( or (?(?C)
/((?(?C'')\Q\E(?!((?(?C'')(?!X=X));=)r*X=X));=)/
# End of testinput2
Error -63: PCRE2_ERROR_BADDATA (unknown error number)
Error -62: bad serialized data