[pcre/f16] Fix repeated forward reference

Petr Pisar ppisar at fedoraproject.org
Tue Nov 22 16:15:10 UTC 2011


commit 0d4b51a93b0dabbb7a1e161000b3ec0752506f2c
Author: Petr Písař <ppisar at redhat.com>
Date:   Tue Nov 22 16:38:38 2011 +0100

    Fix repeated forward reference

 pcre-8.12-forward_reference.patch |   85 +++++++++++++++++++++++++++++++++++++
 pcre.spec                         |    8 +++-
 2 files changed, 92 insertions(+), 1 deletions(-)
---
diff --git a/pcre-8.12-forward_reference.patch b/pcre-8.12-forward_reference.patch
new file mode 100644
index 0000000..c53fa96
--- /dev/null
+++ b/pcre-8.12-forward_reference.patch
@@ -0,0 +1,85 @@
+From 50f01d47c8d09258b523ea19951abb7c8649eb61 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar at redhat.com>
+Date: Tue, 22 Nov 2011 17:06:59 +0100
+Subject: [PATCH] Fix repeated forward reference needed character bug
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From:
+r762 | ph10 | 2011-11-22 14:36:51 +0100 (Út, 22 lis 2011) | 2 lines
+
+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.
+
+Petr Pisar: Changelog removed.
+See <http://lists.pcre.org/lurker/message/20111121.203922.3cfd476e.en.html>.
+---
+ pcre_compile.c        |    8 ++++++--
+ testdata/testinput11  |    3 +++
+ testdata/testoutput11 |    6 ++++++
+ 3 files changed, 15 insertions(+), 2 deletions(-)
+
+diff --git a/pcre_compile.c b/pcre_compile.c
+index 694ddce..859c0c7 100644
+--- a/pcre_compile.c
++++ b/pcre_compile.c
+@@ -4577,7 +4577,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
+             {
+@@ -5591,7 +5592,9 @@ for (;; ptr++)
+ 
+           /* Insert the recursion/subroutine item, automatically wrapped inside
+           "once" brackets. Set up a "previous group" length so that a
+-          subsequent quantifier will work. */
++          subsequent quantifier will work. It does not have a set first
++          byte (relevant if it is repeated, because it will then be wrapped 
++          with ONCE brackets). */
+ 
+           *code = OP_ONCE;
+           PUT(code, 1, 2 + 2*LINK_SIZE);
+@@ -5600,6 +5603,7 @@ for (;; ptr++)
+           *code = OP_RECURSE;
+           PUT(code, 1, (int)(called - cd->start_code));
+           code += 1 + LINK_SIZE;
++          groupsetfirstbyte = FALSE;
+ 
+           *code = OP_KET;
+           PUT(code, 1, 2 + 2*LINK_SIZE);
+diff --git a/testdata/testinput11 b/testdata/testinput11
+index 79ebd08..4e764fa 100644
+--- a/testdata/testinput11
++++ b/testdata/testinput11
+@@ -507,4 +507,7 @@ however, we need the complication for Perl. ---/
+ /(?P<abn>(?P=abn)xxx|)+/
+     xxx
+ 
++/(a)(?2){2}(.)/
++    abcd
++
+ /-- End of testinput11 --/
+diff --git a/testdata/testoutput11 b/testdata/testoutput11
+index dbd22e7..73739ac 100644
+--- a/testdata/testoutput11
++++ b/testdata/testoutput11
+@@ -975,4 +975,10 @@ No match
+  0: 
+  1: 
+ 
++/(a)(?2){2}(.)/
++    abcd
++ 0: abcd
++ 1: a
++ 2: d
++
+ /-- End of testinput11 --/
+-- 
+1.7.7.3
+
diff --git a/pcre.spec b/pcre.spec
index 5e6b42e..18d2068 100644
--- a/pcre.spec
+++ b/pcre.spec
@@ -1,6 +1,6 @@
 Name: pcre
 Version: 8.12
-Release: 4%{?dist}
+Release: 5%{?dist}
 Summary: Perl-compatible regular expression library
 Group: System Environment/Libraries
 License: BSD
@@ -13,6 +13,8 @@ Patch1: pcre-8.12-manual_typos.patch
 Patch2: pcre-8.12-refused_spelling_terminated.patch
 # In upstream, bug #702623
 Patch3: pcre-8.12-caseless_reference.patch
+# Fix repeated forward reference, in upstream after 8.20.
+Patch4: pcre-8.12-forward_reference.patch
 # New libtool to get rid of rpath
 BuildRequires: autoconf, automake, libtool
 
@@ -47,6 +49,7 @@ libtoolize --copy --force && autoreconf
 %patch1 -p0 -b .manual_typos
 %patch2 -p1 -b .terminated_typos
 %patch3 -p0 -b .caseless_reference
+%patch4 -p1 -b .forward_reference
 # One contributor's name is non-UTF-8
 for F in ChangeLog; do
     iconv -f latin1 -t utf8 "$F" >"${F}.utf8"
@@ -106,6 +109,9 @@ make check
 %doc COPYING LICENCE 
 
 %changelog
+* Tue Nov 22 2011 Petr Pisar <ppisar at redhat.com> - 8.12-5
+- Fix repeated forward reference (bug #755969)
+
 * Mon May 09 2011 Petr Pisar <ppisar at redhat.com> - 8.12-4
 - Fix caseless reference matching in UTF-8 mode when the upper/lower case
   characters have different lengths (bug #702623)


More information about the scm-commits mailing list