Revision: 762
http://vcs.pcre.org/viewvc?view=rev&revision=762
Author: ph10
Date: 2011-11-22 13:36:51 +0000 (Tue, 22 Nov 2011)
Log Message:
-----------
Fix repeated forward reference needed character bug.
Modified Paths:
--------------
code/trunk/ChangeLog
code/trunk/pcre_compile.c
code/trunk/testdata/testinput11
code/trunk/testdata/testoutput11
Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog 2011-11-22 12:24:26 UTC (rev 761)
+++ code/trunk/ChangeLog 2011-11-22 13:36:51 UTC (rev 762)
@@ -58,6 +58,9 @@
15. If a forward reference was repeated with an upper limit of around 2000,
it caused the error "internal error: overran compiling workspace". This
is now checked, and causes "too many forward references" instead.
+
+16. A repeated forward reference in a pattern such as (a)(?2){2}(.) was
+ incorrectly expecting the subject to contain another "a" after the start.
Version 8.20 21-Oct-2011
Modified: code/trunk/pcre_compile.c
===================================================================
--- code/trunk/pcre_compile.c 2011-11-22 12:24:26 UTC (rev 761)
+++ code/trunk/pcre_compile.c 2011-11-22 13:36:51 UTC (rev 762)
@@ -4884,7 +4884,8 @@
*lengthptr += delta;
}
- /* This is compiling for real */
+ /* This is compiling for real. If there is a set first byte for
+ the group, and we have not yet set a "required byte", set it. */
else
{
@@ -6015,11 +6016,14 @@
}
}
- /* Insert the recursion/subroutine item. */
+ /* Insert the recursion/subroutine item. It does not have a set first
+ byte (relevant if it is repeated, because it will then be wrapped
+ with ONCE brackets). */
*code = OP_RECURSE;
PUT(code, 1, (int)(called - cd->start_code));
code += 1 + LINK_SIZE;
+ groupsetfirstbyte = FALSE;
}
/* Can't determine a first byte now */
Modified: code/trunk/testdata/testinput11
===================================================================
--- code/trunk/testdata/testinput11 2011-11-22 12:24:26 UTC (rev 761)
+++ code/trunk/testdata/testinput11 2011-11-22 13:36:51 UTC (rev 762)
@@ -800,4 +800,7 @@
/(?<=a(*THEN)b)c/
xabcd
+/(a)(?2){2}(.)/
+ abcd
+
/-- End of testinput11 --/
Modified: code/trunk/testdata/testoutput11
===================================================================
--- code/trunk/testdata/testoutput11 2011-11-22 12:24:26 UTC (rev 761)
+++ code/trunk/testdata/testoutput11 2011-11-22 13:36:51 UTC (rev 762)
@@ -1441,4 +1441,10 @@
xabcd
0: c
+/(a)(?2){2}(.)/
+ abcd
+ 0: abcd
+ 1: a
+ 2: d
+
/-- End of testinput11 --/