Fix version conditions in DFA engine

This commit is contained in:
Petr Písař 2019-01-31 11:56:59 +01:00
parent 51d82854ab
commit 95dcb8d3c2
2 changed files with 85 additions and 1 deletions

View File

@ -0,0 +1,77 @@
From 225bd60220208b0908555701a0176b8a9561dbe0 Mon Sep 17 00:00:00 2001
From: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
Date: Tue, 29 Jan 2019 14:34:59 +0000
Subject: [PATCH] Fix bug in VERSION conditional test in DFA matching.
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@1062 6239d852-aaf2-0410-a92c-79f79f948069
Petr Písař: Ported to 10.32.
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
src/pcre2_dfa_match.c | 2 +-
testdata/testinput6 | 10 ++++++++++
testdata/testoutput6 | 14 ++++++++++++++
3 files changed, 25 insertions(+), 1 deletion(-)
diff --git a/src/pcre2_dfa_match.c b/src/pcre2_dfa_match.c
index 818004d..1a7f19d 100644
--- a/src/pcre2_dfa_match.c
+++ b/src/pcre2_dfa_match.c
@@ -2757,7 +2757,7 @@ for (;;)
/* There is also an always-true condition */
else if (condcode == OP_TRUE)
- { ADD_ACTIVE(state_offset + LINK_SIZE + 2 + IMM2_SIZE, 0); }
+ { ADD_ACTIVE(state_offset + LINK_SIZE + 2, 0); }
/* The only supported version of OP_RREF is for the value RREF_ANY,
which means "test if in any recursion". We can't test for specifically
diff --git a/testdata/testinput6 b/testdata/testinput6
index f7dedb2..684e029 100644
--- a/testdata/testinput6
+++ b/testdata/testinput6
@@ -4955,4 +4955,14 @@
\= Expect no match
\na
+/(?(VERSION>=0)^B0W)/
+ B0W-W0W
+\= Expect no match
+ 0
+
+/(?(VERSION>=1000)^B0W|W0W)/
+ B0W-W0W
+\= Expect no match
+ 0
+
# End of testinput6
diff --git a/testdata/testoutput6 b/testdata/testoutput6
index caec833..051248f 100644
--- a/testdata/testoutput6
+++ b/testdata/testoutput6
@@ -7783,4 +7783,18 @@ No match
\na
No match
+/(?(VERSION>=0)^B0W)/
+ B0W-W0W
+ 0: B0W
+\= Expect no match
+ 0
+No match
+
+/(?(VERSION>=1000)^B0W|W0W)/
+ B0W-W0W
+ 0: W0W
+\= Expect no match
+ 0
+No match
+
# End of testinput6
--
2.17.2

View File

@ -9,7 +9,7 @@
#%%global rcversion RC1
Name: pcre2
Version: 10.32
Release: %{?rcversion:0.}6%{?rcversion:.%rcversion}%{?dist}
Release: %{?rcversion:0.}7%{?rcversion:.%rcversion}%{?dist}
%global myversion %{version}%{?rcversion:-%rcversion}
Summary: Perl-compatible regular expression library
# the library: BSD with exceptions
@ -74,6 +74,9 @@ Patch7: pcre2-10.32-Provide-alternative-POSIX-names.patch
# Link applications to PCRE2-specific symbols when using POSIX API, bug #1667614,
# upstream bug 1830, proposed to upstream
Patch8: pcre2-10.32-Declare-POSIX-regex-function-names-as-macros-to-PCRE.patch
# Fix version conditions in DFA engine, upstream bug #2367,
# in upstream after 10.32
Patch9: pcre2-10.32-Fix-bug-in-VERSION-conditional-test-in-DFA-matching.patch
BuildRequires: autoconf
BuildRequires: automake
BuildRequires: coreutils
@ -158,6 +161,7 @@ Utilities demonstrating PCRE2 capabilities like pcre2grep or pcre2test.
%patch6 -p1
%patch7 -p1
%patch8 -p1
%patch9 -p1
# Because of multilib patch
libtoolize --copy --force
autoreconf -vif
@ -259,6 +263,9 @@ make %{?_smp_mflags} check VERBOSE=yes
%{_mandir}/man1/pcre2test.*
%changelog
* Thu Jan 31 2019 Petr Pisar <ppisar@redhat.com> - 10.32-7
- Fix version conditions in DFA engine (upstream bug #2367)
* Tue Jan 22 2019 Petr Pisar <ppisar@redhat.com> - 10.32-6
- Link applications to PCRE2-specific symbols when using POSIX API (bug #1667614)