[pcre/f14] Fix repeated forward reference
Petr Pisar
ppisar at fedoraproject.org
Tue Nov 22 16:46:14 UTC 2011
commit 350bd2cf4f2171425bf02ab6f8ac32223a0aa66a
Author: Petr Písař <ppisar at redhat.com>
Date: Tue Nov 22 16:38:38 2011 +0100
Fix repeated forward reference
pcre-8.10-forward_reference.patch | 85 +++++++++++++++++++++++++++++++++++++
pcre.spec | 8 +++-
2 files changed, 92 insertions(+), 1 deletions(-)
---
diff --git a/pcre-8.10-forward_reference.patch b/pcre-8.10-forward_reference.patch
new file mode 100644
index 0000000..2ce9a7e
--- /dev/null
+++ b/pcre-8.10-forward_reference.patch
@@ -0,0 +1,85 @@
+From 5a62a5dd8541ee3d21e9035bdce8a16b466f5207 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:40:57 +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 f1dc714..eaca91d 100644
+--- a/pcre_compile.c
++++ b/pcre_compile.c
+@@ -4514,7 +4514,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
+ {
+@@ -5497,7 +5498,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);
+@@ -5506,6 +5509,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 795e1be..7960f88 100644
+--- a/testdata/testinput11
++++ b/testdata/testinput11
+@@ -483,4 +483,7 @@ however, we need the complication for Perl. ---/
+ /(?&t)(?#()(?(DEFINE)(?<t>a))/
+ bac
+
++/(a)(?2){2}(.)/
++ abcd
++
+ /-- End of testinput11 --/
+diff --git a/testdata/testoutput11 b/testdata/testoutput11
+index 6270d5b..ae791e8 100644
+--- a/testdata/testoutput11
++++ b/testdata/testoutput11
+@@ -942,4 +942,10 @@ No match
+ bac
+ 0: a
+
++/(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 a6b412e..dc7609c 100644
--- a/pcre.spec
+++ b/pcre.spec
@@ -1,12 +1,14 @@
Name: pcre
Version: 8.10
-Release: 2%{?dist}
+Release: 3%{?dist}
Summary: Perl-compatible regular expression library
URL: http://www.pcre.org/
Source: ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/%{name}-%{version}.tar.bz2
Patch0: pcre-8.10-multilib.patch
# In upstream, bug #702623
Patch1: pcre-8.10-caseless_reference.patch
+# Fix repeated forward reference, in upstream after 8.20.
+Patch2: pcre-8.10-forward_reference.patch
License: BSD
Group: System Environment/Libraries
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
@@ -42,6 +44,7 @@ Library for static linking for %{name}.
%patch0 -p1 -b .multilib
libtoolize --copy --force && autoreconf
%patch1 -p1 -b .caseless_reference
+%patch2 -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"
@@ -105,6 +108,9 @@ rm -rf $RPM_BUILD_ROOT
%doc COPYING LICENCE
%changelog
+* Tue Nov 22 2011 Petr Pisar <ppisar at redhat.com> - 8.10-3
+- Fix repeated forward reference (bug #755969)
+
* Mon May 09 2011 Petr Pisar <ppisar at redhat.com> - 8.10-2
- 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