Fix incorrect first matching character when a backreference with zero minimum repeat starts a pattern
This commit is contained in:
parent
13135a397c
commit
6649114634
@ -0,0 +1,74 @@
|
||||
From 774be03b760cb4b56abf686f6dc56ac4de07fa67 Mon Sep 17 00:00:00 2001
|
||||
From: ph10 <ph10@2f5784b3-3f2a-0410-8824-cb99058d5e15>
|
||||
Date: Tue, 12 Dec 2017 15:07:18 +0000
|
||||
Subject: [PATCH] Fix wrong first character when a backreference with a zero
|
||||
repeat is first (apart from assersions) in a pattern.
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
git-svn-id: svn://vcs.exim.org/pcre/code/trunk@1719 2f5784b3-3f2a-0410-8824-cb99058d5e15
|
||||
Petr Písař: Ported to 8.41.
|
||||
---
|
||||
pcre_compile.c | 2 +-
|
||||
testdata/testinput2 | 8 ++++++++
|
||||
testdata/testoutput2 | 16 ++++++++++++++++
|
||||
|
||||
diff --git a/pcre_compile.c b/pcre_compile.c
|
||||
index 42f204c..6dd8886 100644
|
||||
--- a/pcre_compile.c
|
||||
+++ b/pcre_compile.c
|
||||
@@ -8060,7 +8060,7 @@ for (;; ptr++)
|
||||
single group (i.e. not to a duplicated name. */
|
||||
|
||||
HANDLE_REFERENCE:
|
||||
- if (firstcharflags == REQ_UNSET) firstcharflags = REQ_NONE;
|
||||
+ if (firstcharflags == REQ_UNSET) zerofirstcharflags = firstcharflags = REQ_NONE;
|
||||
previous = code;
|
||||
item_hwm_offset = cd->hwm - cd->start_workspace;
|
||||
*code++ = ((options & PCRE_CASELESS) != 0)? OP_REFI : OP_REF;
|
||||
diff --git a/testdata/testinput2 b/testdata/testinput2
|
||||
index 08c6f39..8ba4dc4 100644
|
||||
--- a/testdata/testinput2
|
||||
+++ b/testdata/testinput2
|
||||
@@ -4249,4 +4249,12 @@ backtracking verbs. --/
|
||||
|
||||
/(?=.*[A-Z])/I
|
||||
|
||||
+"(?<=(a))\1?b"
|
||||
+ ab
|
||||
+ aaab
|
||||
+
|
||||
+"(?=(a))\1?b"
|
||||
+ ab
|
||||
+ aaab
|
||||
+
|
||||
/-- End of testinput2 --/
|
||||
diff --git a/testdata/testoutput2 b/testdata/testoutput2
|
||||
index 811bbef..61ed8d9 100644
|
||||
--- a/testdata/testoutput2
|
||||
+++ b/testdata/testoutput2
|
||||
@@ -14705,4 +14705,20 @@ No options
|
||||
No first char
|
||||
No need char
|
||||
|
||||
+"(?<=(a))\1?b"
|
||||
+ ab
|
||||
+ 0: b
|
||||
+ 1: a
|
||||
+ aaab
|
||||
+ 0: ab
|
||||
+ 1: a
|
||||
+
|
||||
+"(?=(a))\1?b"
|
||||
+ ab
|
||||
+ 0: ab
|
||||
+ 1: a
|
||||
+ aaab
|
||||
+ 0: ab
|
||||
+ 1: a
|
||||
+
|
||||
/-- End of testinput2 --/
|
||||
--
|
||||
2.13.6
|
||||
|
@ -44,6 +44,9 @@ Patch4: pcre-8.41-Fix-possible-memory-leak-introduced-in-previous-bug-.patch
|
||||
# Allow pcregrep match counter to handle values larger than 2147483647,
|
||||
# upstream bug #2208, in upstream after 8.41
|
||||
Patch5: pcre-8.41-Change-pcregrep-linenumbers-and-counts-to-long-ints.patch
|
||||
# Fix incorrect first matching character when a backreference with zero minimum
|
||||
# repeat starts a pattern, upstream bug #2209, in upstream after 8.41
|
||||
Patch6: pcre-8.41-Fix-wrong-first-character-when-a-backreference-with-.patch
|
||||
BuildRequires: readline-devel
|
||||
BuildRequires: autoconf
|
||||
BuildRequires: automake
|
||||
@ -131,6 +134,7 @@ Utilities demonstrating PCRE capabilities like pcregrep or pcretest.
|
||||
%patch3 -p1
|
||||
%patch4 -p1
|
||||
%patch5 -p1
|
||||
%patch6 -p1
|
||||
# Because of rpath patch
|
||||
libtoolize --copy --force
|
||||
autoreconf -vif
|
||||
@ -235,6 +239,8 @@ make %{?_smp_mflags} check VERBOSE=yes
|
||||
* Fri Jan 12 2018 Petr Pisar <ppisar@redhat.com> - 8.41-4
|
||||
- Allow pcregrep match counter to handle values larger than 2147483647
|
||||
(upstream bug #2208)
|
||||
- Fix incorrect first matching character when a backreference with zero minimum
|
||||
repeat starts a pattern (upstream bug #2209)
|
||||
|
||||
* Thu Nov 02 2017 Petr Pisar <ppisar@redhat.com> - 8.41-3
|
||||
- Accept files names longer than 128 bytes in recursive mode of pcregrep
|
||||
|
Loading…
Reference in New Issue
Block a user