[pcre/f21] Reset non-matched groups within capturing group up to forced match

Petr Pisar ppisar at fedoraproject.org
Fri Nov 7 12:29:06 UTC 2014


commit 4e52a46def94c12512a883b0c85b053dc3d854a4
Author: Petr Písař <ppisar at redhat.com>
Date:   Fri Nov 7 13:00:15 2014 +0100

    Reset non-matched groups within capturing group up to forced match

 ...n-there-are-unset-groups-prior-to-ACCEPT-.patch |   78 ++++++++++++++++++++
 pcre.spec                                          |   10 ++-
 2 files changed, 87 insertions(+), 1 deletions(-)
---
diff --git a/pcre-8.35-Fix-bug-when-there-are-unset-groups-prior-to-ACCEPT-.patch b/pcre-8.35-Fix-bug-when-there-are-unset-groups-prior-to-ACCEPT-.patch
new file mode 100644
index 0000000..6d5f15f
--- /dev/null
+++ b/pcre-8.35-Fix-bug-when-there-are-unset-groups-prior-to-ACCEPT-.patch
@@ -0,0 +1,78 @@
+From acdd8fc2e9995d0f67625d03a5a903f76c5d68a7 Mon Sep 17 00:00:00 2001
+From: ph10 <ph10 at 2f5784b3-3f2a-0410-8824-cb99058d5e15>
+Date: Wed, 5 Nov 2014 15:08:03 +0000
+Subject: [PATCH] Fix bug when there are unset groups prior to (*ACCEPT) within
+ a capturing group.
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1510 2f5784b3-3f2a-0410-8824-cb99058d5e15
+Signed-off-by: Petr Písař <ppisar at redhat.com>
+
+Petr Pisar: Ported to 8.35
+
+Signed-off-by: Petr Písař <ppisar at redhat.com>
+---
+ pcre_exec.c          | 13 ++++++++++++-
+ testdata/testinput1  |  3 +++
+ testdata/testoutput1 |  9 +++++++++
+ 3 files changed, 24 insertions(+), 1 deletion(-)
+
+diff --git a/pcre_exec.c b/pcre_exec.c
+index 5a8dbad..0227740 100644
+--- a/pcre_exec.c
++++ b/pcre_exec.c
+@@ -1474,7 +1474,18 @@ for (;;)
+       md->offset_vector[offset] =
+         md->offset_vector[md->offset_end - number];
+       md->offset_vector[offset+1] = (int)(eptr - md->start_subject);
+-      if (offset_top <= offset) offset_top = offset + 2;
++
++      /* If this group is at or above the current highwater mark, ensure that
++      any groups between the current high water mark and this group are marked
++      unset and then update the high water mark. */
++
++      if (offset >= offset_top)
++        {
++        register int *iptr = md->offset_vector + offset_top;
++        register int *iend = md->offset_vector + offset;
++        while (iptr < iend) *iptr++ = -1;
++        offset_top = offset + 2;
++        }
+       }
+     ecode += 1 + IMM2_SIZE;
+     break;
+diff --git a/testdata/testinput1 b/testdata/testinput1
+index 4a7a015..e1d9b5c 100644
+--- a/testdata/testinput1
++++ b/testdata/testinput1
+@@ -5690,4 +5690,7 @@ AbcdCBefgBhiBqz
+ '\A(?:[^\"]++|\"(?:[^\"]++|\"\")++\")++'
+     NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED
+ 
++/(?:((abcd))|(((?:(?:(?:(?:abc|(?:abcdef))))b)abcdefghi)abc)|((*ACCEPT)))/
++    1234abcd
++
+ /-- End of testinput1 --/
+diff --git a/testdata/testoutput1 b/testdata/testoutput1
+index 6710f42..11374ce 100644
+--- a/testdata/testoutput1
++++ b/testdata/testoutput1
+@@ -9347,4 +9347,13 @@ No match
+     NON QUOTED \"QUOT\"\"ED\" AFTER \"NOT MATCHED
+  0: NON QUOTED "QUOT""ED" AFTER 
+ 
++/(?:((abcd))|(((?:(?:(?:(?:abc|(?:abcdef))))b)abcdefghi)abc)|((*ACCEPT)))/
++    1234abcd
++ 0: 
++ 1: <unset>
++ 2: <unset>
++ 3: <unset>
++ 4: <unset>
++ 5: 
++
+ /-- End of testinput1 --/
+-- 
+1.9.3
+
diff --git a/pcre.spec b/pcre.spec
index aa5947c..89d1008 100644
--- a/pcre.spec
+++ b/pcre.spec
@@ -2,7 +2,7 @@
 #%%global rcversion RC1
 Name: pcre
 Version: 8.35
-Release: %{?rcversion:0.}6%{?rcversion:.%rcversion}%{?dist}.1
+Release: %{?rcversion:0.}7%{?rcversion:.%rcversion}%{?dist}
 %global myversion %{version}%{?rcversion:-%rcversion}
 Summary: Perl-compatible regular expression library
 Group: System Environment/Libraries
@@ -38,6 +38,9 @@ Patch8: pcre-8.35-Fix-compiler-crash-misbehaviour-for-zero-repeated-gr.patch
 # Fix compile-time loop for recursive reference within a group with an
 # indefinite repeat, bug #1128577, upstream bug #1515, in upstream after 8.35
 Patch9: pcre-8.35-Fix-compile-time-loop-for-recursive-reference-within.patch
+# Reset non-matched groups within capturing group up to forced match,
+# bug #1161587, in upstream after 8.36
+Patch10: pcre-8.35-Fix-bug-when-there-are-unset-groups-prior-to-ACCEPT-.patch
 BuildRequires: readline-devel
 # New libtool to get rid of rpath
 BuildRequires: autoconf, automake, libtool
@@ -87,6 +90,7 @@ Utilities demonstrating PCRE capabilities like pcregrep or pcretest.
 %patch7 -p1 -b .pcregrep_leak
 %patch8 -p1 -b .compiler_crash_zero_group
 %patch9 -p1 -b .compiler_loop_recursive_reference
+%patch10 -p1 -b .reset_groups
 # Because of rpath patch
 libtoolize --copy --force && autoreconf -vif
 # One contributor's name is non-UTF-8
@@ -157,6 +161,10 @@ make %{?_smp_mflags} check
 %{_mandir}/man1/pcretest.*
 
 %changelog
+* Fri Nov 07 2014 Petr Pisar <ppisar at redhat.com> - 8.35-7
+- Reset non-matched groups within capturing group up to forced match
+  (bug #1161587)
+
 * Sun Aug 17 2014 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 8.35-6.1
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild
 


More information about the scm-commits mailing list