[pcre] Fix unused memory usage on zero-repeat assertion condition

Petr Pisar ppisar at fedoraproject.org
Thu Nov 20 07:36:14 UTC 2014


commit b2b6fa45ca8ab7bbfc3eb52a174d3c2d3e7aff42
Author: Petr Písař <ppisar at redhat.com>
Date:   Thu Nov 20 08:29:20 2014 +0100

    Fix unused memory usage on zero-repeat assertion condition

 ...6-Fix-zero-repeat-assertion-condition-bug.patch |   68 ++++++++++++++++++++
 pcre.spec                                          |    9 ++-
 2 files changed, 76 insertions(+), 1 deletions(-)
---
diff --git a/pcre-8.36-Fix-zero-repeat-assertion-condition-bug.patch b/pcre-8.36-Fix-zero-repeat-assertion-condition-bug.patch
new file mode 100644
index 0000000..1fb3036
--- /dev/null
+++ b/pcre-8.36-Fix-zero-repeat-assertion-condition-bug.patch
@@ -0,0 +1,68 @@
+From 48d2472840efc4dc54dfc698d64aa086332a9033 Mon Sep 17 00:00:00 2001
+From: ph10 <ph10 at 2f5784b3-3f2a-0410-8824-cb99058d5e15>
+Date: Wed, 19 Nov 2014 20:57:13 +0000
+Subject: [PATCH] Fix zero-repeat assertion condition bug.
+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@1513 2f5784b3-3f2a-0410-8824-cb99058d5e15
+Signed-off-by: Petr Písař <ppisar at redhat.com>
+
+Petr Pisar: Ported to 8.36.
+
+diff --git a/pcre_exec.c b/pcre_exec.c
+index fdf7067..bb5620d 100644
+--- a/pcre_exec.c
++++ b/pcre_exec.c
+@@ -1404,8 +1404,11 @@ for (;;)
+         condition = TRUE;
+ 
+         /* Advance ecode past the assertion to the start of the first branch,
+-        but adjust it so that the general choosing code below works. */
+-
++        but adjust it so that the general choosing code below works. If the 
++        assertion has a quantifier that allows zero repeats we must skip over 
++        the BRAZERO. This is a lunatic thing to do, but somebody did! */
++        
++        if (*ecode == OP_BRAZERO) ecode++; 
+         ecode += GET(ecode, 1);
+         while (*ecode == OP_ALT) ecode += GET(ecode, 1);
+         ecode += 1 + LINK_SIZE - PRIV(OP_lengths)[condcode];
+diff --git a/testdata/testinput2 b/testdata/testinput2
+index c6816bf..015422e 100644
+--- a/testdata/testinput2
++++ b/testdata/testinput2
+@@ -4078,4 +4078,10 @@ backtracking verbs. --/
+ 
+ /\x{whatever}/
+ 
++"((?=(?(?=(?(?=(?(?=())))*)))))"
++    a
++
++"(?(?=)?==)(((((((((?=)))))))))"
++    a
++
+ /-- End of testinput2 --/
+diff --git a/testdata/testoutput2 b/testdata/testoutput2
+index 1e87026..9a1b14e 100644
+--- a/testdata/testoutput2
++++ b/testdata/testoutput2
+@@ -14206,4 +14206,14 @@ Failed: digits missing in \x{} or \o{} at offset 3
+ /\x{whatever}/
+ Failed: non-hex character in \x{} (closing brace missing?) at offset 3
+ 
++"((?=(?(?=(?(?=(?(?=())))*)))))"
++    a
++ 0: 
++ 1: 
++ 2: 
++
++"(?(?=)?==)(((((((((?=)))))))))"
++    a
++No match
++
+ /-- End of testinput2 --/
+-- 
+1.9.3
+
diff --git a/pcre.spec b/pcre.spec
index ff16b9a..7193bce 100644
--- a/pcre.spec
+++ b/pcre.spec
@@ -2,7 +2,7 @@
 #%%global rcversion RC1
 Name: pcre
 Version: 8.36
-Release: %{?rcversion:0.}2%{?rcversion:.%rcversion}%{?dist}
+Release: %{?rcversion:0.}3%{?rcversion:.%rcversion}%{?dist}
 %global myversion %{version}%{?rcversion:-%rcversion}
 Summary: Perl-compatible regular expression library
 Group: System Environment/Libraries
@@ -16,6 +16,9 @@ Patch1: pcre-8.32-refused_spelling_terminated.patch
 # Reset non-matched groups within capturing group up to forced match,
 # bug #1161587, in upstream after 8.36
 Patch2: pcre-8.36-Fix-bug-when-there-are-unset-groups-prior-to-ACCEPT-.patch
+# Fix unused memory usage on zero-repeat assertion condition, bug #1165626,
+# in upstream after 8.36
+Patch3: pcre-8.36-Fix-zero-repeat-assertion-condition-bug.patch
 BuildRequires: readline-devel
 # New libtool to get rid of rpath
 BuildRequires: autoconf, automake, libtool
@@ -58,6 +61,7 @@ Utilities demonstrating PCRE capabilities like pcregrep or pcretest.
 %patch0 -p1 -b .multilib
 %patch1 -p1 -b .terminated_typos
 %patch2 -p1 -b .reset_groups
+%patch3 -p1 -b .zero_repeat_assertion
 # Because of rpath patch
 libtoolize --copy --force && autoreconf -vif
 # One contributor's name is non-UTF-8
@@ -128,6 +132,9 @@ make %{?_smp_mflags} check VERBOSE=yes
 %{_mandir}/man1/pcretest.*
 
 %changelog
+* Thu Nov 20 2014 Petr Pisar <ppisar at redhat.com> - 8.36-3
+- Fix unused memory usage on zero-repeat assertion condition (bug #1165626)
+
 * Fri Nov 07 2014 Petr Pisar <ppisar at redhat.com> - 8.36-2
 - Reset non-matched groups within capturing group up to forced match
   (bug #1161587)


More information about the scm-commits mailing list