Fix matching a zero-repeated subroutine call at a start of a pattern
This commit is contained in:
parent
4e27468b9c
commit
3760442647
@ -0,0 +1,112 @@
|
||||
From 977cdd668535a54fc8a13ce4a92d9866503b21ea Mon Sep 17 00:00:00 2001
|
||||
From: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
|
||||
Date: Sat, 20 Oct 2018 09:28:02 +0000
|
||||
Subject: [PATCH] Fix zero-repeated subroutine call at start of pattern bug,
|
||||
which recorded an incorrect first code unit.
|
||||
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@1032 6239d852-aaf2-0410-a92c-79f79f948069
|
||||
Petr Písař: Ported to 10.32.
|
||||
|
||||
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
||||
---
|
||||
src/pcre2_compile.c | 8 +++++---
|
||||
testdata/testinput1 | 15 +++++++++++++++
|
||||
testdata/testoutput1 | 24 ++++++++++++++++++++++++
|
||||
3 files changed, 44 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/src/pcre2_compile.c b/src/pcre2_compile.c
|
||||
index 6bb1de3..50dfd47 100644
|
||||
--- a/src/pcre2_compile.c
|
||||
+++ b/src/pcre2_compile.c
|
||||
@@ -5901,7 +5901,7 @@ for (;; pptr++)
|
||||
}
|
||||
goto GROUP_PROCESS_NOTE_EMPTY;
|
||||
|
||||
- /* The DEFINE condition is always false. It's internal groups may never
|
||||
+ /* The DEFINE condition is always false. Its internal groups may never
|
||||
be called, so matched_char must remain false, hence the jump to
|
||||
GROUP_PROCESS rather than GROUP_PROCESS_NOTE_EMPTY. */
|
||||
|
||||
@@ -6237,8 +6237,8 @@ for (;; pptr++)
|
||||
groupnumber = ng->number;
|
||||
|
||||
/* For a recursion, that's all that is needed. We can now go to
|
||||
- the code above that handles numerical recursion, applying it to
|
||||
- the first group with the given name. */
|
||||
+ the code that handles numerical recursion, applying it to the first
|
||||
+ group with the given name. */
|
||||
|
||||
if (meta == META_RECURSE_BYNAME)
|
||||
{
|
||||
@@ -7286,6 +7286,8 @@ for (;; pptr++)
|
||||
groupsetfirstcu = FALSE;
|
||||
cb->had_recurse = TRUE;
|
||||
if (firstcuflags == REQ_UNSET) firstcuflags = REQ_NONE;
|
||||
+ zerofirstcu = firstcu;
|
||||
+ zerofirstcuflags = firstcuflags;
|
||||
break;
|
||||
|
||||
|
||||
diff --git a/testdata/testinput1 b/testdata/testinput1
|
||||
index d8615ee..fce38b2 100644
|
||||
--- a/testdata/testinput1
|
||||
+++ b/testdata/testinput1
|
||||
@@ -6263,4 +6263,19 @@ ef) x/x,mark
|
||||
aBCDEF
|
||||
AbCDe f
|
||||
|
||||
+/ (?<word> \w+ )* \. /xi
|
||||
+ pokus.
|
||||
+
|
||||
+/(?(DEFINE) (?<word> \w+ ) ) (?&word)* \./xi
|
||||
+ pokus.
|
||||
+
|
||||
+/(?(DEFINE) (?<word> \w+ ) ) ( (?&word)* ) \./xi
|
||||
+ pokus.
|
||||
+
|
||||
+/(?&word)* (?(DEFINE) (?<word> \w+ ) ) \./xi
|
||||
+ pokus.
|
||||
+
|
||||
+/(?&word)* \. (?<word> \w+ )/xi
|
||||
+ pokus.hokus
|
||||
+
|
||||
# End of testinput1
|
||||
diff --git a/testdata/testoutput1 b/testdata/testoutput1
|
||||
index 77b9ff0..ff88775 100644
|
||||
--- a/testdata/testoutput1
|
||||
+++ b/testdata/testoutput1
|
||||
@@ -9929,4 +9929,28 @@ No match
|
||||
AbCDe f
|
||||
No match
|
||||
|
||||
+/ (?<word> \w+ )* \. /xi
|
||||
+ pokus.
|
||||
+ 0: pokus.
|
||||
+ 1: pokus
|
||||
+
|
||||
+/(?(DEFINE) (?<word> \w+ ) ) (?&word)* \./xi
|
||||
+ pokus.
|
||||
+ 0: pokus.
|
||||
+
|
||||
+/(?(DEFINE) (?<word> \w+ ) ) ( (?&word)* ) \./xi
|
||||
+ pokus.
|
||||
+ 0: pokus.
|
||||
+ 1: <unset>
|
||||
+ 2: pokus
|
||||
+
|
||||
+/(?&word)* (?(DEFINE) (?<word> \w+ ) ) \./xi
|
||||
+ pokus.
|
||||
+ 0: pokus.
|
||||
+
|
||||
+/(?&word)* \. (?<word> \w+ )/xi
|
||||
+ pokus.hokus
|
||||
+ 0: pokus.hokus
|
||||
+ 1: hokus
|
||||
+
|
||||
# End of testinput1
|
||||
--
|
||||
2.17.2
|
||||
|
10
pcre2.spec
10
pcre2.spec
@ -9,7 +9,7 @@
|
||||
#%%global rcversion RC1
|
||||
Name: pcre2
|
||||
Version: 10.32
|
||||
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
|
||||
@ -56,6 +56,9 @@ Patch1: pcre2-10.32-Fix-subject-buffer-overread-in-JIT.-Found-by-Yunho-K.pat
|
||||
# Fix caseless matching an extended class in JIT mode, upstream bug #2321,
|
||||
# in upstream after 10.32
|
||||
Patch2: pcre2-10.32-Fix-an-xclass-matching-issue-in-JIT.patch
|
||||
# Fix matching a zero-repeated subroutine call at a start of a pattern,
|
||||
# upstream bug #2332, in upstream after 10.32
|
||||
Patch3: pcre2-10.32-Fix-zero-repeated-subroutine-call-at-start-of-patter.patch
|
||||
BuildRequires: autoconf
|
||||
BuildRequires: automake
|
||||
BuildRequires: coreutils
|
||||
@ -134,6 +137,7 @@ Utilities demonstrating PCRE2 capabilities like pcre2grep or pcre2test.
|
||||
%patch0 -p1
|
||||
%patch1 -p1
|
||||
%patch2 -p1
|
||||
%patch3 -p1
|
||||
# Because of multilib patch
|
||||
libtoolize --copy --force
|
||||
autoreconf -vif
|
||||
@ -235,6 +239,10 @@ make %{?_smp_mflags} check VERBOSE=yes
|
||||
%{_mandir}/man1/pcre2test.*
|
||||
|
||||
%changelog
|
||||
* 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
|
||||
(upstream bug #2332)
|
||||
|
||||
* Mon Sep 24 2018 Petr Pisar <ppisar@redhat.com> - 10.32-3
|
||||
- Fix caseless matching an extended class in JIT mode (upstream bug #2321)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user