|
|
08805a |
From aae67c0e3a4d8f1d62700ec4788929b1e2267149 Mon Sep 17 00:00:00 2001
|
|
|
08805a |
From: ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>
|
|
|
08805a |
Date: Sat, 16 May 2015 11:05:40 +0000
|
|
|
08805a |
Subject: [PATCH 2/3] Fix named forward reference to duplicate group number
|
|
|
08805a |
overflow bug.
|
|
|
08805a |
MIME-Version: 1.0
|
|
|
08805a |
Content-Type: text/plain; charset=UTF-8
|
|
|
08805a |
Content-Transfer-Encoding: 8bit
|
|
|
08805a |
|
|
|
08805a |
Port to 8.32:
|
|
|
08805a |
|
|
|
08805a |
commit 2fa78aa4e42bcebf2d616c4ee89c012f29dc3447
|
|
|
08805a |
Author: ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>
|
|
|
08805a |
Date: Sat May 16 11:05:40 2015 +0000
|
|
|
08805a |
|
|
|
08805a |
Fix named forward reference to duplicate group number overflow bug.
|
|
|
08805a |
|
|
|
08805a |
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1559 2f5784b3-3f2a-0410-8824-cb99058d5e15
|
|
|
08805a |
|
|
|
08805a |
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
|
|
08805a |
---
|
|
|
08805a |
pcre_compile.c | 8 ++++++++
|
|
|
08805a |
testdata/testinput1 | 3 +++
|
|
|
08805a |
testdata/testoutput1 | 5 +++++
|
|
|
08805a |
3 files changed, 16 insertions(+)
|
|
|
08805a |
|
|
|
08805a |
diff --git a/pcre_compile.c b/pcre_compile.c
|
|
|
08805a |
index 4506e56..6777542 100644
|
|
|
08805a |
--- a/pcre_compile.c
|
|
|
08805a |
+++ b/pcre_compile.c
|
|
|
08805a |
@@ -6300,6 +6300,14 @@ for (;; ptr++)
|
|
|
08805a |
16-bit data item. */
|
|
|
08805a |
|
|
|
08805a |
*lengthptr += IMM2_SIZE;
|
|
|
08805a |
+
|
|
|
08805a |
+ /* If this is a forward reference and we are within a (?|...) group,
|
|
|
08805a |
+ the reference may end up as the number of a group which we are
|
|
|
08805a |
+ currently inside, that is, it could be a recursive reference. In the
|
|
|
08805a |
+ real compile this will be picked up and the reference wrapped with
|
|
|
08805a |
+ OP_ONCE to make it atomic, so we must space in case this occurs. */
|
|
|
08805a |
+
|
|
|
08805a |
+ if (recno == 0) *lengthptr += 2 + 2*LINK_SIZE;
|
|
|
08805a |
}
|
|
|
08805a |
|
|
|
08805a |
/* In the real compile, seek the name in the table. We check the name
|
|
|
08805a |
diff --git a/testdata/testinput1 b/testdata/testinput1
|
|
|
08805a |
index c45e1ba..9f513f6 100644
|
|
|
08805a |
--- a/testdata/testinput1
|
|
|
08805a |
+++ b/testdata/testinput1
|
|
|
08805a |
@@ -5327,4 +5327,7 @@ name were given. ---/
|
|
|
08805a |
/(?:((abcd))|(((?:(?:(?:(?:abc|(?:abcdef))))b)abcdefghi)abc)|((*ACCEPT)))/
|
|
|
08805a |
1234abcd
|
|
|
08805a |
|
|
|
08805a |
+"(?|(\k'Pm')|(?'Pm'))"
|
|
|
08805a |
+ abcd
|
|
|
08805a |
+
|
|
|
08805a |
/-- End of testinput1 --/
|
|
|
08805a |
diff --git a/testdata/testoutput1 b/testdata/testoutput1
|
|
|
08805a |
index f0eae49..0fbff41 100644
|
|
|
08805a |
--- a/testdata/testoutput1
|
|
|
08805a |
+++ b/testdata/testoutput1
|
|
|
08805a |
@@ -8834,4 +8834,9 @@ No match
|
|
|
08805a |
4: <unset>
|
|
|
08805a |
5:
|
|
|
08805a |
|
|
|
08805a |
+"(?|(\k'Pm')|(?'Pm'))"
|
|
|
08805a |
+ abcd
|
|
|
08805a |
+ 0:
|
|
|
08805a |
+ 1:
|
|
|
08805a |
+
|
|
|
08805a |
/-- End of testinput1 --/
|
|
|
08805a |
--
|
|
|
08805a |
2.5.5
|
|
|
08805a |
|