summaryrefslogtreecommitdiff
path: root/pcre_compile.c
diff options
context:
space:
mode:
authorph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2015-03-02 17:09:58 +0000
committerph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>2015-03-02 17:09:58 +0000
commitcdd0774e59b4bd58bbabe25c1b3580b66fac44c6 (patch)
treec9a573da4012f16e90c51f5f8949dbc0433d48a5 /pcre_compile.c
parent6b33cd6e7980da3bd28959392bcdc13316df4fe0 (diff)
downloadpcre-cdd0774e59b4bd58bbabe25c1b3580b66fac44c6.tar.gz
Fix bad compilation for patterns like /((?+1)(\1))/ with forward reference
subroutine and recursive back reference within the same group. git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1529 2f5784b3-3f2a-0410-8824-cb99058d5e15
Diffstat (limited to 'pcre_compile.c')
-rw-r--r--pcre_compile.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/pcre_compile.c b/pcre_compile.c
index 5c77c1c..13f738e 100644
--- a/pcre_compile.c
+++ b/pcre_compile.c
@@ -8103,6 +8103,7 @@ int length;
unsigned int orig_bracount;
unsigned int max_bracount;
branch_chain bc;
+size_t save_hwm_offset;
/* If set, call the external function that checks for stack availability. */
@@ -8120,6 +8121,8 @@ bc.current_branch = code;
firstchar = reqchar = 0;
firstcharflags = reqcharflags = REQ_UNSET;
+save_hwm_offset = cd->hwm - cd->start_workspace;
+
/* Accumulate the length for use in the pre-compile phase. Start with the
length of the BRA and KET and any extra bytes that are required at the
beginning. We accumulate in a local variable to save frequent testing of
@@ -8322,7 +8325,7 @@ for (;;)
{
*code = OP_END;
adjust_recurse(start_bracket, 1 + LINK_SIZE,
- (options & PCRE_UTF8) != 0, cd, cd->hwm - cd->start_workspace);
+ (options & PCRE_UTF8) != 0, cd, save_hwm_offset);
memmove(start_bracket + 1 + LINK_SIZE, start_bracket,
IN_UCHARS(code - start_bracket));
*start_bracket = OP_ONCE;