Revision: 236
http://www.exim.org/viewvc/pcre2?view=rev&revision=236
Author: ph10
Date: 2015-03-29 16:40:45 +0100 (Sun, 29 Mar 2015)
Log Message:
-----------
Fix non-diagnosis of syntax error for (?(?< when not followed by ! or =.
Modified Paths:
--------------
code/trunk/ChangeLog
code/trunk/src/pcre2_compile.c
code/trunk/testdata/testinput2
code/trunk/testdata/testoutput2
Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog 2015-03-29 11:15:32 UTC (rev 235)
+++ code/trunk/ChangeLog 2015-03-29 15:40:45 UTC (rev 236)
@@ -45,7 +45,12 @@
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.
+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
---------------------------
Modified: code/trunk/src/pcre2_compile.c
===================================================================
--- code/trunk/src/pcre2_compile.c 2015-03-29 11:15:32 UTC (rev 235)
+++ code/trunk/src/pcre2_compile.c 2015-03-29 15:40:45 UTC (rev 236)
@@ -5272,7 +5272,9 @@
if (tempptr[1] == CHAR_QUESTION_MARK &&
(tempptr[2] == CHAR_EQUALS_SIGN ||
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;
break;
Modified: code/trunk/testdata/testinput2
===================================================================
--- code/trunk/testdata/testinput2 2015-03-29 11:15:32 UTC (rev 235)
+++ code/trunk/testdata/testinput2 2015-03-29 15:40:45 UTC (rev 236)
@@ -4241,4 +4241,8 @@
"(*NO_JIT)((?2)+)((?1)){"
abcd{
+# Perl fails to diagnose the absence of an assertion
+
+"(?(?<E>.*!.*)?)"
+
# End of testinput2
Modified: code/trunk/testdata/testoutput2
===================================================================
--- code/trunk/testdata/testoutput2 2015-03-29 11:15:32 UTC (rev 235)
+++ code/trunk/testdata/testoutput2 2015-03-29 15:40:45 UTC (rev 236)
@@ -573,7 +573,7 @@
Failed: error 115 at offset 7: reference to non-existent subpattern
/(?(?<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
Capturing subpattern count = 1
@@ -14204,4 +14204,9 @@
abcd{
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