75 lines
1.8 KiB
Diff
75 lines
1.8 KiB
Diff
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
|
|
|