Fix a non-JIT match to return (*MARK) names from a successful conditional assertion
This commit is contained in:
parent
cbc8dff071
commit
9bf6f2950c
@ -0,0 +1,83 @@
|
||||
From 993928201df0c42258f32da6c882b791b1fab441 Mon Sep 17 00:00:00 2001
|
||||
From: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
|
||||
Date: Thu, 13 Jun 2019 16:49:40 +0000
|
||||
Subject: [PATCH] Make pcre2_match() return (*MARK) names from successful
|
||||
conditional assertions, as Perl and the JIT do.
|
||||
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@1104 6239d852-aaf2-0410-a92c-79f79f948069
|
||||
Petr Písař: Ported to 10.33.
|
||||
---
|
||||
src/pcre2_match.c | 7 ++++---
|
||||
testdata/testinput1 | 8 ++++++++
|
||||
testdata/testoutput1 | 14 ++++++++++++++
|
||||
|
||||
diff --git a/src/pcre2_match.c b/src/pcre2_match.c
|
||||
index 849bb58..c7730a2 100644
|
||||
--- a/src/pcre2_match.c
|
||||
+++ b/src/pcre2_match.c
|
||||
@@ -5472,15 +5472,16 @@ fprintf(stderr, "++ op=%d\n", *Fecode);
|
||||
|
||||
/* If we are at the end of an assertion that is a condition, return a
|
||||
match, discarding any intermediate backtracking points. Copy back the
|
||||
- captures into the frame before N so that they are set on return. Doing
|
||||
- this for all assertions, both positive and negative, seems to match what
|
||||
- Perl does. */
|
||||
+ mark setting and the captures into the frame before N so that they are
|
||||
+ set on return. Doing this for all assertions, both positive and negative,
|
||||
+ seems to match what Perl does. */
|
||||
|
||||
if (GF_IDMASK(N->group_frame_type) == GF_CONDASSERT)
|
||||
{
|
||||
memcpy((char *)P + offsetof(heapframe, ovector), Fovector,
|
||||
Foffset_top * sizeof(PCRE2_SIZE));
|
||||
P->offset_top = Foffset_top;
|
||||
+ P->mark = Fmark;
|
||||
Fback_frame = (char *)F - (char *)P;
|
||||
RRETURN(MATCH_MATCH);
|
||||
}
|
||||
diff --git a/testdata/testinput1 b/testdata/testinput1
|
||||
index 3fd5d2a..7b6918a 100644
|
||||
--- a/testdata/testinput1
|
||||
+++ b/testdata/testinput1
|
||||
@@ -6343,4 +6343,12 @@ ef) x/x,mark
|
||||
/(?&word)* \. (?<word> \w+ )/xi
|
||||
pokus.hokus
|
||||
|
||||
+/a(?(?=(*:2)b).)/mark
|
||||
+ abc
|
||||
+ acb
|
||||
+
|
||||
+/a(?(?!(*:2)b).)/mark
|
||||
+ acb
|
||||
+ abc
|
||||
+
|
||||
# End of testinput1
|
||||
diff --git a/testdata/testoutput1 b/testdata/testoutput1
|
||||
index 8fd67b3..d9f8c3b 100644
|
||||
--- a/testdata/testoutput1
|
||||
+++ b/testdata/testoutput1
|
||||
@@ -10049,4 +10049,18 @@ No match
|
||||
0: pokus.hokus
|
||||
1: hokus
|
||||
|
||||
+/a(?(?=(*:2)b).)/mark
|
||||
+ abc
|
||||
+ 0: ab
|
||||
+MK: 2
|
||||
+ acb
|
||||
+ 0: a
|
||||
+
|
||||
+/a(?(?!(*:2)b).)/mark
|
||||
+ acb
|
||||
+ 0: ac
|
||||
+ abc
|
||||
+ 0: a
|
||||
+MK: 2
|
||||
+
|
||||
# End of testinput1
|
||||
--
|
||||
2.20.1
|
||||
|
10
pcre2.spec
10
pcre2.spec
@ -9,7 +9,7 @@
|
||||
#%%global rcversion RC1
|
||||
Name: pcre2
|
||||
Version: 10.33
|
||||
Release: %{?rcversion:0.}3%{?rcversion:.%rcversion}%{?dist}
|
||||
Release: %{?rcversion:0.}4%{?rcversion:.%rcversion}%{?dist}
|
||||
%global myversion %{version}%{?rcversion:-%rcversion}
|
||||
Summary: Perl-compatible regular expression library
|
||||
# the library: BSD with exceptions
|
||||
@ -59,6 +59,9 @@ Patch3: pcre2-10.33-Fix-crash-when-X-is-used-without-UTF-in-JIT.patch
|
||||
# 2/2 Fix a crash when \X is used without UTF mode in a JIT, upstream bug #2399,
|
||||
# in upstream after 10.33
|
||||
Patch4: pcre2-10.33-Forgot-this-file-in-previous-commit.-Fixes-JIT-non-U.patch
|
||||
# Fix a non-JIT match to return (*MARK) names from a successful conditional
|
||||
# assertion, in upstream after 10.33
|
||||
Patch5: pcre2-10.33-Make-pcre2_match-return-MARK-names-from-successful-c.patch
|
||||
BuildRequires: autoconf
|
||||
BuildRequires: automake
|
||||
BuildRequires: coreutils
|
||||
@ -139,6 +142,7 @@ Utilities demonstrating PCRE2 capabilities like pcre2grep or pcre2test.
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
# Because of multilib patch
|
||||
libtoolize --copy --force
|
||||
autoreconf -vif
|
||||
@ -237,6 +241,10 @@ make %{?_smp_mflags} check VERBOSE=yes
|
||||
%{_mandir}/man1/pcre2test.*
|
||||
|
||||
%changelog
|
||||
* Mon Jun 17 2019 Petr Pisar <ppisar@redhat.com> - 10.33-4
|
||||
- Fix a non-JIT match to return (*MARK) names from a successful conditional
|
||||
assertion
|
||||
|
||||
* Mon May 13 2019 Petr Pisar <ppisar@redhat.com> - 10.33-3
|
||||
- Correct a misspelling in a documentation
|
||||
- Fix a crash when \X is used without UTF mode in a JIT (upstream bug #2399)
|
||||
|
Loading…
Reference in New Issue
Block a user