[Pcre-svn] [1566] code/trunk: Fix group empty match bug.

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [1566] code/trunk: Fix group empty match bug.
Revision: 1566
          http://vcs.pcre.org/viewvc?view=rev&revision=1566
Author:   ph10
Date:     2015-06-09 18:45:25 +0100 (Tue, 09 Jun 2015)
Log Message:
-----------
Fix group empty match bug.


Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/pcre_compile.c
    code/trunk/testdata/testinput2
    code/trunk/testdata/testoutput2


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2015-06-09 16:46:52 UTC (rev 1565)
+++ code/trunk/ChangeLog    2015-06-09 17:45:25 UTC (rev 1566)
@@ -47,6 +47,10 @@


 10. There was a buffer overflow if pcre_exec() was called with an ovector of 
     size 1. This bug was found by american fuzzy lop.
+    
+11. If a non-capturing group containing a conditional group that could match
+    an empty string was repeated, it was not identified as matching an empty
+    string itself. For example: /^(?:(?(1)x|)+)+$()/.



Version 8.37 28-April-2015

Modified: code/trunk/pcre_compile.c
===================================================================
--- code/trunk/pcre_compile.c    2015-06-09 16:46:52 UTC (rev 1565)
+++ code/trunk/pcre_compile.c    2015-06-09 17:45:25 UTC (rev 1566)
@@ -2487,7 +2487,7 @@
   if (c == OP_BRA  || c == OP_BRAPOS ||
       c == OP_CBRA || c == OP_CBRAPOS ||
       c == OP_ONCE || c == OP_ONCE_NC ||
-      c == OP_COND)
+      c == OP_COND || c == OP_SCOND)
     {
     BOOL empty_branch;
     if (GET(code, 1) == 0) return TRUE;    /* Hit unclosed bracket */


Modified: code/trunk/testdata/testinput2
===================================================================
--- code/trunk/testdata/testinput2    2015-06-09 16:46:52 UTC (rev 1565)
+++ code/trunk/testdata/testinput2    2015-06-09 17:45:25 UTC (rev 1566)
@@ -4178,4 +4178,6 @@
 //
 \O1


+/^(?:(?(1)x|)+)+$()/BZ
+
/-- End of testinput2 --/

Modified: code/trunk/testdata/testoutput2
===================================================================
--- code/trunk/testdata/testoutput2    2015-06-09 16:46:52 UTC (rev 1565)
+++ code/trunk/testdata/testoutput2    2015-06-09 17:45:25 UTC (rev 1566)
@@ -14468,4 +14468,22 @@
 \O1
 Matched, but too many substrings


+/^(?:(?(1)x|)+)+$()/BZ
+------------------------------------------------------------------
+        Bra
+        ^
+        SBra
+        SCond
+      1 Cond ref
+        x
+        Alt
+        KetRmax
+        KetRmax
+        $
+        CBra 1
+        Ket
+        Ket
+        End
+------------------------------------------------------------------
+
 /-- End of testinput2 --/