Fix non-diagnosis of syntax error for (?(?< when not followed by ! or =.

This commit is contained in:
Philip.Hazel 2015-03-29 15:40:45 +00:00
parent 99bb61e903
commit 63cab0dba9
4 changed files with 18 additions and 2 deletions

View File

@ -45,6 +45,11 @@ discovered by the LLVM fuzzer.
between a subroutine call and its quantifier was incorrectly compiled, leading between a subroutine call and its quantifier was incorrectly compiled, leading
to buffer overflow or other errors. This bug was discovered by the LLVM fuzzer. to buffer overflow or other errors. This bug was discovered by the LLVM fuzzer.
12. The illegal pattern /(?(?<E>.*!.*)?)/ was not being diagnosed as missing an
assertion after (?(. The code was failing to check the character after (?(?<
for the ! or = that would indicate a lookbehind assertion. This bug was
discovered by the LLVM fuzzer.
Version 10.10 06-March-2015 Version 10.10 06-March-2015
--------------------------- ---------------------------

View File

@ -5272,7 +5272,9 @@ for (;; ptr++)
if (tempptr[1] == CHAR_QUESTION_MARK && if (tempptr[1] == CHAR_QUESTION_MARK &&
(tempptr[2] == CHAR_EQUALS_SIGN || (tempptr[2] == CHAR_EQUALS_SIGN ||
tempptr[2] == CHAR_EXCLAMATION_MARK || tempptr[2] == CHAR_EXCLAMATION_MARK ||
tempptr[2] == CHAR_LESS_THAN_SIGN)) (tempptr[2] == CHAR_LESS_THAN_SIGN &&
(tempptr[3] == CHAR_EQUALS_SIGN ||
tempptr[3] == CHAR_EXCLAMATION_MARK))))
{ {
cb->iscondassert = TRUE; cb->iscondassert = TRUE;
break; break;

4
testdata/testinput2 vendored
View File

@ -4241,4 +4241,8 @@ a random value. /Ix
"(*NO_JIT)((?2)+)((?1)){" "(*NO_JIT)((?2)+)((?1)){"
abcd{ abcd{
# Perl fails to diagnose the absence of an assertion
"(?(?<E>.*!.*)?)"
# End of testinput2 # End of testinput2

View File

@ -573,7 +573,7 @@ Failed: error 128 at offset 3: assertion expected after (?( or (?(?C)
Failed: error 115 at offset 7: reference to non-existent subpattern Failed: error 115 at offset 7: reference to non-existent subpattern
/(?(?<ab))/ /(?(?<ab))/
Failed: error 142 at offset 7: syntax error in subpattern name (missing terminator) Failed: error 128 at offset 3: assertion expected after (?( or (?(?C)
/((?s)blah)\s+\1/I /((?s)blah)\s+\1/I
Capturing subpattern count = 1 Capturing subpattern count = 1
@ -14204,4 +14204,9 @@ No match
abcd{ abcd{
Failed: error -52: nested recursion at the same subject position Failed: error -52: nested recursion at the same subject position
# Perl fails to diagnose the absence of an assertion
"(?(?<E>.*!.*)?)"
Failed: error 128 at offset 3: assertion expected after (?( or (?(?C)
# End of testinput2 # End of testinput2