Fix anchoring a pattern preceded with (*MARK)

This commit is contained in:
Petr Písař 2019-01-03 14:42:54 +01:00
parent 9c04090949
commit 52ae0ed053
2 changed files with 101 additions and 1 deletions

View File

@ -0,0 +1,94 @@
From 1e78fb74388943447942b5aca9bcdb60c42d0977 Mon Sep 17 00:00:00 2001
From: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
Date: Tue, 27 Nov 2018 16:00:58 +0000
Subject: [PATCH] Fix non-recognition of anchoring when preceded by (*MARK)
etc.
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@1048 6239d852-aaf2-0410-a92c-79f79f948069
Petr Písař <ppisar@redhat.com>: Ported to 10.32.
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
src/pcre2_compile.c | 10 +++++++++-
testdata/testinput2 | 6 ++++++
testdata/testoutput2 | 18 ++++++++++++++++++
3 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/src/pcre2_compile.c b/src/pcre2_compile.c
index 50dfd47..12d9058 100644
--- a/src/pcre2_compile.c
+++ b/src/pcre2_compile.c
@@ -4421,6 +4421,14 @@ for (;;)
code += GET(code, 1) + 1 + LINK_SIZE;
break;
+ case OP_MARK:
+ case OP_COMMIT_ARG:
+ case OP_PRUNE_ARG:
+ case OP_SKIP_ARG:
+ case OP_THEN_ARG:
+ code += code[1] + PRIV(OP_lengths)[*code];
+ break;
+
default:
return code;
}
@@ -7287,7 +7295,7 @@ for (;; pptr++)
cb->had_recurse = TRUE;
if (firstcuflags == REQ_UNSET) firstcuflags = REQ_NONE;
zerofirstcu = firstcu;
- zerofirstcuflags = firstcuflags;
+ zerofirstcuflags = firstcuflags;
break;
diff --git a/testdata/testinput2 b/testdata/testinput2
index fc94b35..6164ebb 100644
--- a/testdata/testinput2
+++ b/testdata/testinput2
@@ -5505,4 +5505,10 @@ a)"xI
bbc
xbc
+/(*:XX)^abc/I
+
+/(*COMMIT:XX)^abc/I
+
+/(*ACCEPT:XX)^abc/I
+
# End of testinput2
diff --git a/testdata/testoutput2 b/testdata/testoutput2
index ecf0d80..f90941f 100644
--- a/testdata/testoutput2
+++ b/testdata/testoutput2
@@ -16763,6 +16763,24 @@ Subject length lower bound = 1
0: b
0+ c
+/(*:XX)^abc/I
+Capturing subpattern count = 0
+Compile options: <none>
+Overall options: anchored
+First code unit = 'a'
+Subject length lower bound = 3
+
+/(*COMMIT:XX)^abc/I
+Capturing subpattern count = 0
+Compile options: <none>
+Overall options: anchored
+First code unit = 'a'
+Subject length lower bound = 3
+
+/(*ACCEPT:XX)^abc/I
+Capturing subpattern count = 0
+Subject length lower bound = 0
+
# End of testinput2
Error -70: PCRE2_ERROR_BADDATA (unknown error number)
Error -62: bad serialized data
--
2.17.2

View File

@ -9,7 +9,7 @@
#%%global rcversion RC1 #%%global rcversion RC1
Name: pcre2 Name: pcre2
Version: 10.32 Version: 10.32
Release: %{?rcversion:0.}4%{?rcversion:.%rcversion}%{?dist} Release: %{?rcversion:0.}5%{?rcversion:.%rcversion}%{?dist}
%global myversion %{version}%{?rcversion:-%rcversion} %global myversion %{version}%{?rcversion:-%rcversion}
Summary: Perl-compatible regular expression library Summary: Perl-compatible regular expression library
# the library: BSD with exceptions # the library: BSD with exceptions
@ -62,6 +62,8 @@ Patch3: pcre2-10.32-Fix-zero-repeated-subroutine-call-at-start-of-patter.pat
# Fix heap limit checking overflow in pcre2_dfa_match(), upstream bug #2334, # Fix heap limit checking overflow in pcre2_dfa_match(), upstream bug #2334,
# in upstream after 10.32 # in upstream after 10.32
Patch4: pcre2-10.32-Fix-heap-limit-checking-overflow-bug-in-pcre2_dfa_ma.patch Patch4: pcre2-10.32-Fix-heap-limit-checking-overflow-bug-in-pcre2_dfa_ma.patch
# Fix anchoring a pattern preceded with (*MARK), in upstream after 10.32
Patch5: pcre2-10.32-Fix-non-recognition-of-anchoring-when-preceded-by-MA.patch
BuildRequires: autoconf BuildRequires: autoconf
BuildRequires: automake BuildRequires: automake
BuildRequires: coreutils BuildRequires: coreutils
@ -142,6 +144,7 @@ Utilities demonstrating PCRE2 capabilities like pcre2grep or pcre2test.
%patch2 -p1 %patch2 -p1
%patch3 -p1 %patch3 -p1
%patch4 -p1 %patch4 -p1
%patch5 -p1
# Because of multilib patch # Because of multilib patch
libtoolize --copy --force libtoolize --copy --force
autoreconf -vif autoreconf -vif
@ -243,6 +246,9 @@ make %{?_smp_mflags} check VERBOSE=yes
%{_mandir}/man1/pcre2test.* %{_mandir}/man1/pcre2test.*
%changelog %changelog
* Thu Jan 03 2019 Petr Pisar <ppisar@redhat.com> - 10.32-5
- Fix anchoring a pattern preceded with (*MARK)
* Thu Nov 01 2018 Petr Pisar <ppisar@redhat.com> - 10.32-4 * Thu Nov 01 2018 Petr Pisar <ppisar@redhat.com> - 10.32-4
- Fix matching a zero-repeated subroutine call at a start of a pattern - Fix matching a zero-repeated subroutine call at a start of a pattern
(upstream bug #2332) (upstream bug #2332)