Fix backtracking atomic groups when they are not separated by something with a backtracking point

This commit is contained in:
Petr Písař 2018-07-31 14:47:46 +02:00
parent 950ebaa590
commit bf7e53caa6
2 changed files with 76 additions and 1 deletions

View File

@ -0,0 +1,67 @@
From bba8a81a820ffcfc9c88adb0055e12bad66eee4e Mon Sep 17 00:00:00 2001
From: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
Date: Mon, 16 Jul 2018 15:24:32 +0000
Subject: [PATCH] Fixed atomic group backtracking bug.
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@965 6239d852-aaf2-0410-a92c-79f79f948069
Petr Písař: Ported to 8.31.
Signed-off-by: Petr Písař <ppisar@redhat.com>
---
src/pcre2_match.c | 2 +-
testdata/testinput1 | 6 ++++++
testdata/testoutput1 | 8 ++++++++
3 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/src/pcre2_match.c b/src/pcre2_match.c
index ce96016..c294049 100644
--- a/src/pcre2_match.c
+++ b/src/pcre2_match.c
@@ -5509,7 +5509,7 @@ fprintf(stderr, "++ op=%d\n", *Fecode);
frame so that it points to the final branch. */
case OP_ONCE:
- Fback_frame = ((char *)F - (char *)P) + frame_size;
+ Fback_frame = ((char *)F - (char *)P);
for (;;)
{
uint32_t y = GET(P->ecode,1);
diff --git a/testdata/testinput1 b/testdata/testinput1
index 1b3191c..cc11288 100644
--- a/testdata/testinput1
+++ b/testdata/testinput1
@@ -6202,4 +6202,10 @@ ef) x/x,mark
/(?<=(?=.){4,5}x)/
+/(?>a(*:1))(?>b(*:1))(*SKIP:1)x|.*/no_start_optimize
+ abc
+
+/(?>a(*:1))(?>b)(*SKIP:1)x|.*/no_start_optimize
+ abc
+
# End of testinput1
diff --git a/testdata/testoutput1 b/testdata/testoutput1
index 06469fa..2fd2d48 100644
--- a/testdata/testoutput1
+++ b/testdata/testoutput1
@@ -9841,4 +9841,12 @@ No match
/(?<=(?=.){4,5}x)/
+/(?>a(*:1))(?>b(*:1))(*SKIP:1)x|.*/no_start_optimize
+ abc
+ 0: abc
+
+/(?>a(*:1))(?>b)(*SKIP:1)x|.*/no_start_optimize
+ abc
+ 0: abc
+
# End of testinput1
--
2.14.4

View File

@ -9,7 +9,7 @@
#%%global rcversion RC1 #%%global rcversion RC1
Name: pcre2 Name: pcre2
Version: 10.31 Version: 10.31
Release: %{?rcversion:0.}7%{?rcversion:.%rcversion}%{?dist}.1 Release: %{?rcversion:0.}8%{?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
@ -82,6 +82,9 @@ Patch9: pcre2-10.31-Fix-global-search-replace-in-pcre2test-and-pcre2_sub.pat
Patch10: pcre2-10.31-Ignore-qualifiers-on-lookaheads-within-lookbehinds-w.patch Patch10: pcre2-10.31-Ignore-qualifiers-on-lookaheads-within-lookbehinds-w.patch
# Fix parsing VERSION conditions, in upstream after pcre-10.31 # Fix parsing VERSION conditions, in upstream after pcre-10.31
Patch11: pcre2-10.31-Fix-bug-in-VERSION-number-reading.patch Patch11: pcre2-10.31-Fix-bug-in-VERSION-number-reading.patch
# Fix backtracking atomic groups when they are not separated by something with
# a backtracking point, in upstream after 10.31
Patch12: pcre2-10.31-Fixed-atomic-group-backtracking-bug.patch
BuildRequires: autoconf BuildRequires: autoconf
BuildRequires: automake BuildRequires: automake
BuildRequires: coreutils BuildRequires: coreutils
@ -169,6 +172,7 @@ Utilities demonstrating PCRE2 capabilities like pcre2grep or pcre2test.
%patch9 -p1 %patch9 -p1
%patch10 -p1 %patch10 -p1
%patch11 -p1 %patch11 -p1
%patch12 -p1
# Because of multilib patch # Because of multilib patch
libtoolize --copy --force libtoolize --copy --force
autoreconf -vif autoreconf -vif
@ -271,6 +275,10 @@ make %{?_smp_mflags} check VERBOSE=yes
%{_mandir}/man1/pcre2test.* %{_mandir}/man1/pcre2test.*
%changelog %changelog
* Tue Jul 31 2018 Petr Pisar <ppisar@redhat.com> - 10.31-8
- Fix backtracking atomic groups when they are not separated by something with
a backtracking point
* Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 10.31-7.1 * Fri Jul 13 2018 Fedora Release Engineering <releng@fedoraproject.org> - 10.31-7.1
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild