From e797d847f47932c745ab8b053e5ff6b759406575 Mon Sep 17 00:00:00 2001 From: Petr Písař Date: Nov 22 2011 16:28:53 +0000 Subject: Fix repeated forward reference --- 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?= +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 . +--- + 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(?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 845fb33..7daf46a 100644 --- a/pcre.spec +++ b/pcre.spec @@ -1,12 +1,14 @@ Name: pcre Version: 8.12 -Release: 3%{?dist} +Release: 4%{?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.12-caseless_reference.patch +# Fix repeated forward reference, in upstream after 8.20. +Patch2: pcre-8.12-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 -p0 -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" @@ -106,6 +109,9 @@ rm -rf $RPM_BUILD_ROOT %doc COPYING LICENCE %changelog +* Tue Nov 22 2011 Petr Pisar - 8.12-4 +- Fix repeated forward reference (bug #755969) + * Mon May 09 2011 Petr Pisar - 8.12-3 - Fix caseless reference matching in UTF-8 mode when the upper/lower case characters have different lengths (bug #702623)