Fix compilation of a pattern with mutual recursion nested inside other group

This commit is contained in:
Petr Písař 2015-04-09 17:24:44 +02:00
parent 6e32159aad
commit 07d112eaa6
2 changed files with 66 additions and 0 deletions

View File

@ -0,0 +1,60 @@
From 9ddce66fd62671186bcd66b1aa72e31cba135c26 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Thu, 9 Apr 2015 17:23:38 +0200
Subject: [PATCH] Fix mutual recursion inside other groups stack overflow bug.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Upstream commit ported to 8.36:
commit e97ec7dc839022a3efe740c532ea3e67e4446430
Author: ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>
Date: Fri Mar 27 17:48:28 2015 +0000
Fix mutual recursion inside other groups stack overflow bug.
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1537 2f5784b3-3f2a-0410-8824-cb99058d5e15
Signed-off-by: Petr Písař <ppisar@redhat.com>
diff --git a/pcre_compile.c b/pcre_compile.c
index c256ea5..ce187cd 100644
--- a/pcre_compile.c
+++ b/pcre_compile.c
@@ -2469,8 +2469,8 @@ for (code = first_significant_code(code + PRIV(OP_lengths)[*code], TRUE);
empty_branch = FALSE;
do
{
- if (!empty_branch && could_be_empty_branch(code, endcode, utf, cd, NULL))
- empty_branch = TRUE;
+ if (!empty_branch && could_be_empty_branch(code, endcode, utf, cd,
+ recurses)) empty_branch = TRUE;
code += GET(code, 1);
}
while (*code == OP_ALT);
diff --git a/testdata/testinput2 b/testdata/testinput2
index 015422e..c01a094 100644
--- a/testdata/testinput2
+++ b/testdata/testinput2
@@ -4084,4 +4084,6 @@ backtracking verbs. --/
"(?(?=)?==)(((((((((?=)))))))))"
a
+"((?2)+)((?1))"
+
/-- End of testinput2 --/
diff --git a/testdata/testoutput2 b/testdata/testoutput2
index 9a1b14e..0118730 100644
--- a/testdata/testoutput2
+++ b/testdata/testoutput2
@@ -14216,4 +14216,6 @@ Failed: non-hex character in \x{} (closing brace missing?) at offset 3
a
No match
+"((?2)+)((?1))"
+
/-- End of testinput2 --/
--
2.1.0

View File

@ -25,6 +25,9 @@ Patch4: pcre-8.36-Remove-computing-the-JIT-read-only-data-size-in-adva.patch
# Fix computing size for pattern with a negated special calss in on-UCP mode,
# bug #1210383, in upstream after 8.36
Patch5: pcre-8.36-Fix-memory-bug-for-S-V-H-compile.patch
# Fix compilation of a pattern with mutual recursion nested inside other group,
# bug #1210393, in upstream after 8.36
Patch6: pcre-8.36-Fix-mutual-recursion-inside-other-groups-stack-overf.patch
BuildRequires: readline-devel
# New libtool to get rid of rpath
BuildRequires: autoconf, automake, libtool
@ -70,6 +73,7 @@ Utilities demonstrating PCRE capabilities like pcregrep or pcretest.
%patch3 -p1 -b .zero_repeat_assertion
%patch4 -p1 -b .jit_size
%patch5 -p1 -b .size_special_class
%patch6 -p1 -b .mutual_recursion
# Because of rpath patch
libtoolize --copy --force && autoreconf -vif
# One contributor's name is non-UTF-8
@ -143,6 +147,8 @@ make %{?_smp_mflags} check VERBOSE=yes
* Thu Apr 09 2015 Petr Pisar <ppisar@redhat.com> - 8.36-5
- Fix computing size for pattern with a negated special calss in on-UCP mode
(bug #1210383)
- Fix compilation of a pattern with mutual recursion nested inside other group
(bug #1210393)
* Thu Mar 26 2015 Petr Pisar <ppisar@redhat.com> - 8.36-4
- Fix computing size of JIT read-only data (bug #1206131)