[Pcre-svn] [283] code/trunk: Fix empty string matching bug.

トップ ページ
このメッセージを削除
著者: Subversion repository
日付:  
To: pcre-svn
題目: [Pcre-svn] [283] code/trunk: Fix empty string matching bug.
Revision: 283
          http://www.exim.org/viewvc/pcre2?view=rev&revision=283
Author:   ph10
Date:     2015-06-09 18:41:45 +0100 (Tue, 09 Jun 2015)
Log Message:
-----------
Fix empty string matching bug.


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-06-09 16:33:44 UTC (rev 282)
+++ code/trunk/ChangeLog    2015-06-09 17:41:45 UTC (rev 283)
@@ -151,7 +151,11 @@
 38. The table entry for \l in EBCDIC environments was incorrect, leading to its
 being treated as a literal 'l' instead of causing an error.


+39. 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 10.10 06-March-2015
---------------------------


Modified: code/trunk/src/pcre2_compile.c
===================================================================
--- code/trunk/src/pcre2_compile.c    2015-06-09 16:33:44 UTC (rev 282)
+++ code/trunk/src/pcre2_compile.c    2015-06-09 17:41:45 UTC (rev 283)
@@ -1238,7 +1238,7 @@
   PCRE2_SPTR ccode;


c = *code;
-
+
/* Skip over forward assertions; the other assertions are skipped by
first_significant_code() with a TRUE final argument. */

@@ -1338,7 +1338,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:33:44 UTC (rev 282)
+++ code/trunk/testdata/testinput2    2015-06-09 17:41:45 UTC (rev 283)
@@ -4325,4 +4325,6 @@


/(?<=|(\,\$(?73591620449005828816)\xa8.{7}){6}\x09)/

+/^(?:(?(1)x|)+)+$()/B
+
# End of testinput2

Modified: code/trunk/testdata/testoutput2
===================================================================
--- code/trunk/testdata/testoutput2    2015-06-09 16:33:44 UTC (rev 282)
+++ code/trunk/testdata/testoutput2    2015-06-09 17:41:45 UTC (rev 283)
@@ -14452,4 +14452,22 @@
 /(?<=|(\,\$(?73591620449005828816)\xa8.{7}){6}\x09)/
 Failed: error 161 at offset 32: number is too big


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