[Pcre-svn] [934] code/trunk: Stop (*COMMIT) escaping from a …

Top Page

Reply to this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [934] code/trunk: Stop (*COMMIT) escaping from a recursive subroutine call.
Revision: 934
          http://vcs.pcre.org/viewvc?view=rev&revision=934
Author:   ph10
Date:     2012-02-25 12:30:36 +0000 (Sat, 25 Feb 2012)


Log Message:
-----------
Stop (*COMMIT) escaping from a recursive subroutine call.

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


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2012-02-25 12:18:23 UTC (rev 933)
+++ code/trunk/ChangeLog    2012-02-25 12:30:36 UTC (rev 934)
@@ -54,6 +54,8 @@
     recursion). Instead of malloc and free for each heap frame each time a 
     logical recursion happens, frames are retained on a chain and re-used where 
     possible. This sometimes gives as much as 30% improvement.  
+    
+13. (*COMMIT) is now correctly confined to within a recursive subpattern call.



Version 8.30 04-February-2012

Modified: code/trunk/pcre_exec.c
===================================================================
--- code/trunk/pcre_exec.c    2012-02-25 12:18:23 UTC (rev 933)
+++ code/trunk/pcre_exec.c    2012-02-25 12:30:36 UTC (rev 934)
@@ -1789,10 +1789,11 @@
           goto RECURSION_MATCHED;        /* Exit loop; end processing */
           }


-        /* PCRE does not allow THEN to escape beyond a recursion; it is treated
-        as NOMATCH. */
+        /* PCRE does not allow THEN or COMMIT to escape beyond a recursion; it
+        is treated as NOMATCH. */


-        else if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN)
+        else if (rrc != MATCH_NOMATCH && rrc != MATCH_THEN &&
+                 rrc != MATCH_COMMIT)
           {
           DPRINTF(("Recursion gave error %d\n", rrc));
           if (new_recursive.offset_save != stacksave)


Modified: code/trunk/testdata/testinput1
===================================================================
--- code/trunk/testdata/testinput1    2012-02-25 12:18:23 UTC (rev 933)
+++ code/trunk/testdata/testinput1    2012-02-25 12:30:36 UTC (rev 934)
@@ -5250,4 +5250,7 @@
 /(another)?(\1+)test/
     hello world test


+/(a(*COMMIT)b){0}a(?1)|aac/
+    aac
+
 /-- End of testinput1 --/


Modified: code/trunk/testdata/testoutput1
===================================================================
--- code/trunk/testdata/testoutput1    2012-02-25 12:18:23 UTC (rev 933)
+++ code/trunk/testdata/testoutput1    2012-02-25 12:30:36 UTC (rev 934)
@@ -8715,4 +8715,8 @@
     hello world test
 No match


+/(a(*COMMIT)b){0}a(?1)|aac/
+    aac
+ 0: aac
+
 /-- End of testinput1 --/