Blame SOURCES/pcre-8.32-Fix-named-forward-reference-to-duplicate-group-numbe.patch

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