[Pcre-svn] [1144] code/trunk: (*ACCEPT) at start of branch w…

Páxina inicial
Borrar esta mensaxe
Autor: Subversion repository
Data:  
Para: pcre-svn
Asunto: [Pcre-svn] [1144] code/trunk: (*ACCEPT) at start of branch was not recording " may match empty string".
Revision: 1144
          http://www.exim.org/viewvc/pcre2?view=rev&revision=1144
Author:   ph10
Date:     2019-07-23 17:58:57 +0100 (Tue, 23 Jul 2019)
Log Message:
-----------
(*ACCEPT) at start of branch was not recording "may match empty string".


Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/src/pcre2_compile.c
    code/trunk/testdata/testoutput2


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2019-07-23 12:34:58 UTC (rev 1143)
+++ code/trunk/ChangeLog    2019-07-23 16:58:57 UTC (rev 1144)
@@ -110,6 +110,9 @@


     (c) An empty string partial hard match can be returned for \z and \Z as it
     is documented that they shouldn't match. 
+    
+22. A branch that started with (*ACCEPT) was not being recognized as one that
+could match an empty string. 



Version 10.33 16-April-2019

Modified: code/trunk/src/pcre2_compile.c
===================================================================
--- code/trunk/src/pcre2_compile.c    2019-07-23 12:34:58 UTC (rev 1143)
+++ code/trunk/src/pcre2_compile.c    2019-07-23 16:58:57 UTC (rev 1144)
@@ -5302,6 +5302,7 @@
 PCRE2_UCHAR *previous = NULL;
 PCRE2_UCHAR op_previous;
 BOOL groupsetfirstcu = FALSE;
+BOOL had_accept = FALSE;
 BOOL matched_char = FALSE;
 BOOL previous_matched_char = FALSE;
 const uint8_t *cbits = cb->cbits;
@@ -5436,7 +5437,7 @@
   if (meta < META_ASTERISK || meta > META_MINMAX_QUERY)
     {
     previous = code;
-    if (matched_char) okreturn = 1;
+    if (matched_char && !had_accept) okreturn = 1;
     }


   previous_matched_char = matched_char;
@@ -6075,7 +6076,7 @@
     workspace overflow. Do not set firstcu after *ACCEPT. */


     case META_ACCEPT:
-    cb->had_accept = TRUE;
+    cb->had_accept = had_accept = TRUE;
     for (oc = cb->open_caps;
          oc != NULL && oc->assert_depth >= cb->assert_depth;
          oc = oc->next)


Modified: code/trunk/testdata/testoutput2
===================================================================
--- code/trunk/testdata/testoutput2    2019-07-23 12:34:58 UTC (rev 1143)
+++ code/trunk/testdata/testoutput2    2019-07-23 16:58:57 UTC (rev 1144)
@@ -11241,6 +11241,7 @@


 /(*ACCEPT)a/I,aftertext
 Capture group count = 0
+May match empty string
 Subject length lower bound = 0
     bax
  0: 
@@ -16911,6 +16912,7 @@


/(*ACCEPT:XX)^abc/I
Capture group count = 0
+May match empty string
Subject length lower bound = 0

/abc/replace=xyz