Fix repeated forward reference

This commit is contained in:
Petr Písař 2011-11-22 16:38:38 +01:00
parent 3c7545a57b
commit b41a1da88c
2 changed files with 76 additions and 1 deletions

View File

@ -0,0 +1,69 @@
Fix repeated forward reference needed character bug
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>.
Index: testdata/testoutput11
===================================================================
--- testdata/testoutput11 (revision 761)
+++ testdata/testoutput11 (revision 762)
@@ -1441,4 +1441,10 @@
xabcd
0: c
+/(a)(?2){2}(.)/
+ abcd
+ 0: abcd
+ 1: a
+ 2: d
+
/-- End of testinput11 --/
Index: testdata/testinput11
===================================================================
--- testdata/testinput11 (revision 761)
+++ testdata/testinput11 (revision 762)
@@ -800,4 +800,7 @@
/(?<=a(*THEN)b)c/
xabcd
+/(a)(?2){2}(.)/
+ abcd
+
/-- End of testinput11 --/
Index: pcre_compile.c
===================================================================
--- pcre_compile.c (revision 761)
+++ pcre_compile.c (revision 762)
@@ -4884,7 +4884,8 @@
*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
{
@@ -6015,11 +6016,14 @@
}
}
- /* Insert the recursion/subroutine item. */
+ /* Insert the recursion/subroutine item. It does not have a set first
+ byte (relevant if it is repeated, because it will then be wrapped
+ with ONCE brackets). */
*code = OP_RECURSE;
PUT(code, 1, (int)(called - cd->start_code));
code += 1 + LINK_SIZE;
+ groupsetfirstbyte = FALSE;
}
/* Can't determine a first byte now */

View File

@ -1,7 +1,7 @@
# This is stable release: %%global rcversion RC3
Name: pcre
Version: 8.20
Release: %{?rcversion:0.}4%{?rcversion:.%rcversion}%{?dist}
Release: %{?rcversion:0.}5%{?rcversion:.%rcversion}%{?dist}
%global myversion %{version}%{?rcversion:-%rcversion}
Summary: Perl-compatible regular expression library
Group: System Environment/Libraries
@ -15,6 +15,8 @@ Patch1: pcre-8.20-refused_spelling_terminated.patch
Patch2: pcre-8.20-lookbehind.patch
# Fix other look-behind regression, in upstream after 8.20.
Patch3: pcre-8.20-lookbehind-2.patch
# Fix repeated forward reference, in upstream after 8.20.
Patch4: pcre-8.20-forward_reference.patch
BuildRequires: readline-devel
# New libtool to get rid of rpath
BuildRequires: autoconf, automake, libtool
@ -57,6 +59,7 @@ libtoolize --copy --force && autoreconf
%patch1 -p1 -b .terminated_typos
%patch2 -p1 -b .lookbehind
%patch3 -p1 -b .lookbehind3
%patch4 -p0 -b .forward_reference
# One contributor's name is non-UTF-8
for F in ChangeLog; do
iconv -f latin1 -t utf8 "$F" >"${F}.utf8"
@ -127,6 +130,9 @@ make check
%{_mandir}/man1/pcretest.*
%changelog
* Tue Nov 22 2011 Petr Pisar <ppisar@redhat.com> - 8.20-5
- Fix repeated forward reference (bug #755969)
* Wed Nov 16 2011 Petr Pisar <ppisar@redhat.com> - 8.20-4
- Fix other look-behind regressions