[Pcre-svn] [1273] code/trunk: Fix *SKIP infinite loop.

Startseite
Nachricht löschen
Autor: Subversion repository
Datum:  
To: pcre-svn
Betreff: [Pcre-svn] [1273] code/trunk: Fix *SKIP infinite loop.
Revision: 1273
          http://vcs.pcre.org/viewvc?view=rev&revision=1273
Author:   ph10
Date:     2013-03-08 10:25:02 +0000 (Fri, 08 Mar 2013)


Log Message:
-----------
Fix *SKIP infinite loop.

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    2013-03-07 11:30:01 UTC (rev 1272)
+++ code/trunk/ChangeLog    2013-03-08 10:25:02 UTC (rev 1273)
@@ -99,7 +99,9 @@


25. (*PRUNE) is now supported by the JIT compiler.

+26. Fix infinite loop when /(?<=(*SKIP)ac)a/ is matched against aa.

+
Version 8.32 30-November-2012
-----------------------------


Modified: code/trunk/pcre_exec.c
===================================================================
--- code/trunk/pcre_exec.c    2013-03-07 11:30:01 UTC (rev 1272)
+++ code/trunk/pcre_exec.c    2013-03-08 10:25:02 UTC (rev 1273)
@@ -6919,11 +6919,11 @@
     md->ignore_skip_arg = TRUE;
     break;


-    /* SKIP passes back the next starting point explicitly, but if it is the
-    same as the match we have just done, treat it as NOMATCH. */
+    /* SKIP passes back the next starting point explicitly, but if it is no
+    greater than the match we have just done, treat it as NOMATCH. */


     case MATCH_SKIP:
-    if (md->start_match_ptr != start_match)
+    if (md->start_match_ptr > start_match)
       {
       new_start_match = md->start_match_ptr;
       break;


Modified: code/trunk/testdata/testinput1
===================================================================
--- code/trunk/testdata/testinput1    2013-03-07 11:30:01 UTC (rev 1272)
+++ code/trunk/testdata/testinput1    2013-03-08 10:25:02 UTC (rev 1273)
@@ -5312,4 +5312,7 @@
 /(?:(a(*MARK:X)a+(*SKIP:X)b)){0}(?:(?1)|aac)/
     aac 


+/(?<=(*SKIP)ac)a/
+    aa
+
 /-- End of testinput1 --/


Modified: code/trunk/testdata/testoutput1
===================================================================
--- code/trunk/testdata/testoutput1    2013-03-07 11:30:01 UTC (rev 1272)
+++ code/trunk/testdata/testoutput1    2013-03-08 10:25:02 UTC (rev 1273)
@@ -8807,4 +8807,8 @@
     aac 
  0: aac


+/(?<=(*SKIP)ac)a/
+    aa
+No match
+
 /-- End of testinput1 --/