summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2011-11-22 13:36:51 +0000
committerph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2011-11-22 13:36:51 +0000
commit515aa685b85075f95c2a22e9de1f8a91a93a95b9 (patch)
tree11c58eeea85927a1989f868f8e6fe6253a2069c0
parent5fea6b890e1e587926fea3fd7734f9b1028268c4 (diff)
downloadpcre-515aa685b85075f95c2a22e9de1f8a91a93a95b9.tar.gz
Fix repeated forward reference needed character bug.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@762 2f5784b3-3f2a-0410-8824-cb99058d5e15
-rw-r--r--ChangeLog3
-rw-r--r--pcre_compile.c8
-rw-r--r--testdata/testinput113
-rw-r--r--testdata/testoutput116
4 files changed, 18 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 65ca77c..f5c2a18 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -58,6 +58,9 @@ Version 8.21
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
diff --git a/pcre_compile.c b/pcre_compile.c
index a5c6cea..e7033cb 100644
--- a/pcre_compile.c
+++ b/pcre_compile.c
@@ -4884,7 +4884,8 @@ for (;; ptr++)
*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 @@ for (;; ptr++)
}
}
- /* 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 */
diff --git a/testdata/testinput11 b/testdata/testinput11
index a9d1cfd..661f193 100644
--- a/testdata/testinput11
+++ b/testdata/testinput11
@@ -800,4 +800,7 @@ name)/K
/(?<=a(*THEN)b)c/
xabcd
+/(a)(?2){2}(.)/
+ abcd
+
/-- End of testinput11 --/
diff --git a/testdata/testoutput11 b/testdata/testoutput11
index 7fc086f..8bd5da1 100644
--- a/testdata/testoutput11
+++ b/testdata/testoutput11
@@ -1441,4 +1441,10 @@ MK: N
xabcd
0: c
+/(a)(?2){2}(.)/
+ abcd
+ 0: abcd
+ 1: a
+ 2: d
+
/-- End of testinput11 --/