[Pcre-svn] [965] code/trunk: Fixed atomic group backtracking…

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [965] code/trunk: Fixed atomic group backtracking bug.
Revision: 965
          http://www.exim.org/viewvc/pcre2?view=rev&revision=965
Author:   ph10
Date:     2018-07-16 16:24:32 +0100 (Mon, 16 Jul 2018)
Log Message:
-----------
Fixed atomic group backtracking bug.


Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/src/pcre2_match.c
    code/trunk/testdata/testinput1
    code/trunk/testdata/testoutput1


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2018-07-14 17:00:17 UTC (rev 964)
+++ code/trunk/ChangeLog    2018-07-16 15:24:32 UTC (rev 965)
@@ -111,6 +111,12 @@
 24. Updated to Unicode version 11.0.0. As well as the usual addition of new 
 scripts and characters, this involved re-jigging the grapheme break property
 algorithm because Unicode has changed the way emojis are handled.
+
+25. Fixed an obscure bug that struck when there were two atomic groups not 
+separated by something with a backtracking point. There could be an incorrect 
+backtrack into the first of the atomic groups. A complicated example is
+/(?>a(*:1))(?>b)(*SKIP:1)x|.*/ matched against "abc", where the *SKIP 
+shouldn't find a MARK (because is in an atomic group), but it did.



Version 10.31 12-February-2018

Modified: code/trunk/src/pcre2_match.c
===================================================================
--- code/trunk/src/pcre2_match.c    2018-07-14 17:00:17 UTC (rev 964)
+++ code/trunk/src/pcre2_match.c    2018-07-16 15:24:32 UTC (rev 965)
@@ -5509,7 +5509,7 @@
       frame so that it points to the final branch. */


       case OP_ONCE:
-      Fback_frame = ((char *)F - (char *)P) + frame_size;
+      Fback_frame = ((char *)F - (char *)P);
       for (;;)
         {
         uint32_t y = GET(P->ecode,1);


Modified: code/trunk/testdata/testinput1
===================================================================
--- code/trunk/testdata/testinput1    2018-07-14 17:00:17 UTC (rev 964)
+++ code/trunk/testdata/testinput1    2018-07-16 15:24:32 UTC (rev 965)
@@ -6203,4 +6203,10 @@
 /a(?:(*:X))(*SKIP:X)(*F)|(.)/
     abc


+/(?>a(*:1))(?>b(*:1))(*SKIP:1)x|.*/no_start_optimize
+    abc
+
+/(?>a(*:1))(?>b)(*SKIP:1)x|.*/no_start_optimize
+    abc
+
 # End of testinput1 


Modified: code/trunk/testdata/testoutput1
===================================================================
--- code/trunk/testdata/testoutput1    2018-07-14 17:00:17 UTC (rev 964)
+++ code/trunk/testdata/testoutput1    2018-07-16 15:24:32 UTC (rev 965)
@@ -9846,4 +9846,12 @@
  0: b
  1: b


+/(?>a(*:1))(?>b(*:1))(*SKIP:1)x|.*/no_start_optimize
+    abc
+ 0: abc
+
+/(?>a(*:1))(?>b)(*SKIP:1)x|.*/no_start_optimize
+    abc
+ 0: abc
+
 # End of testinput1