Fix compiling a lookbehind when preceded by a DEFINE

This commit is contained in:
Petr Písař 2020-03-16 18:04:33 +01:00
parent 0ea51b6558
commit 51e6a76e15
2 changed files with 66 additions and 0 deletions

View File

@ -0,0 +1,60 @@
From 5bf35f661b7a73e892f6181f22988e5531960501 Mon Sep 17 00:00:00 2001
From: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
Date: Mon, 24 Feb 2020 17:29:00 +0000
Subject: [PATCH] Fix bad lookbehind compilation when preceded by a DEFINE
group.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@1228 6239d852-aaf2-0410-a92c-79f79f948069
Petr Písař: Ported to 10.34.
---
src/pcre2_compile.c | 4 ++++
testdata/testinput1 | 3 +++
testdata/testoutput1 | 4 ++++
3 files changed, 11 insertions(+)
diff --git a/src/pcre2_compile.c b/src/pcre2_compile.c
index 628503c..8083338 100644
--- a/src/pcre2_compile.c
+++ b/src/pcre2_compile.c
@@ -9588,6 +9588,10 @@ for (; *pptr != META_END; pptr++)
break;
case META_COND_DEFINE:
+ pptr += SIZEOFFSET;
+ nestlevel++;
+ break;
+
case META_COND_NAME:
case META_COND_NUMBER:
case META_COND_RNAME:
diff --git a/testdata/testinput1 b/testdata/testinput1
index 959d4b8..6135681 100644
--- a/testdata/testinput1
+++ b/testdata/testinput1
@@ -6399,4 +6399,7 @@ ef) x/x,mark
"(?<=X(?(DEFINE)(Y))(?1))."
AXYZ
+"(?(DEFINE)(?<foo>bar))(?<![-a-z0-9])word"
+ word
+
# End of testinput1
diff --git a/testdata/testoutput1 b/testdata/testoutput1
index dfb6366..ca23e91 100644
--- a/testdata/testoutput1
+++ b/testdata/testoutput1
@@ -10129,4 +10129,8 @@ No match
AXYZ
0: Z
+"(?(DEFINE)(?<foo>bar))(?<![-a-z0-9])word"
+ word
+ 0: word
+
# End of testinput1
--
2.21.1

View File

@ -81,6 +81,9 @@ Patch9: pcre2-10.34-Fix-a-crash-which-occurs-when-the-character-type-of-.pat
# is not followed by a valid low surrogate, upstream bug #2527,
# in upstream after 10.34
Patch10: pcre2-10.34-Fix-bug-in-UTF-16-checker-returning-wrong-offset-for.patch
# Fix compiling a lookbehind when preceded by a DEFINE group,
# upstream bug #2531, in upstream after 10.34
Patch11: pcre2-10.34-Fix-bad-lookbehind-compilation-when-preceded-by-a-DE.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: coreutils
@ -169,6 +172,7 @@ Utilities demonstrating PCRE2 capabilities like pcre2grep or pcre2test.
%patch8 -p1
%patch9 -p1
%patch10 -p1
%patch11 -p1
# Because of multilib patch
libtoolize --copy --force
autoreconf -vif
@ -269,6 +273,8 @@ make %{?_smp_mflags} check VERBOSE=yes
* Mon Mar 16 2020 Petr Pisar <ppisar@redhat.com> - 10.34-8
- Fix computing an offest for the start of the UTF-16 error when a high
surrogate is not followed by a valid low surrogate (upstream bug #2527)
- Fix compiling a lookbehind when preceded by a DEFINE group
(upstream bug #2531)
* Thu Feb 20 2020 Petr Pisar <ppisar@redhat.com> - 10.34-7
- Fix a crash in JIT when an invalid UTF-8 character is encountered in