|
|
d71fdb |
From 977cdd668535a54fc8a13ce4a92d9866503b21ea Mon Sep 17 00:00:00 2001
|
|
|
d71fdb |
From: ph10 <ph10@6239d852-aaf2-0410-a92c-79f79f948069>
|
|
|
d71fdb |
Date: Sat, 20 Oct 2018 09:28:02 +0000
|
|
|
d71fdb |
Subject: [PATCH] Fix zero-repeated subroutine call at start of pattern bug,
|
|
|
d71fdb |
which recorded an incorrect first code unit.
|
|
|
d71fdb |
MIME-Version: 1.0
|
|
|
d71fdb |
Content-Type: text/plain; charset=UTF-8
|
|
|
d71fdb |
Content-Transfer-Encoding: 8bit
|
|
|
d71fdb |
|
|
|
d71fdb |
git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@1032 6239d852-aaf2-0410-a92c-79f79f948069
|
|
|
d71fdb |
Petr Písař: Ported to 10.32.
|
|
|
d71fdb |
|
|
|
d71fdb |
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
|
|
d71fdb |
---
|
|
|
d71fdb |
src/pcre2_compile.c | 8 +++++---
|
|
|
d71fdb |
testdata/testinput1 | 15 +++++++++++++++
|
|
|
d71fdb |
testdata/testoutput1 | 24 ++++++++++++++++++++++++
|
|
|
d71fdb |
3 files changed, 44 insertions(+), 3 deletions(-)
|
|
|
d71fdb |
|
|
|
d71fdb |
diff --git a/src/pcre2_compile.c b/src/pcre2_compile.c
|
|
|
d71fdb |
index 6bb1de3..50dfd47 100644
|
|
|
d71fdb |
--- a/src/pcre2_compile.c
|
|
|
d71fdb |
+++ b/src/pcre2_compile.c
|
|
|
d71fdb |
@@ -5901,7 +5901,7 @@ for (;; pptr++)
|
|
|
d71fdb |
}
|
|
|
d71fdb |
goto GROUP_PROCESS_NOTE_EMPTY;
|
|
|
d71fdb |
|
|
|
d71fdb |
- /* The DEFINE condition is always false. It's internal groups may never
|
|
|
d71fdb |
+ /* The DEFINE condition is always false. Its internal groups may never
|
|
|
d71fdb |
be called, so matched_char must remain false, hence the jump to
|
|
|
d71fdb |
GROUP_PROCESS rather than GROUP_PROCESS_NOTE_EMPTY. */
|
|
|
d71fdb |
|
|
|
d71fdb |
@@ -6237,8 +6237,8 @@ for (;; pptr++)
|
|
|
d71fdb |
groupnumber = ng->number;
|
|
|
d71fdb |
|
|
|
d71fdb |
/* For a recursion, that's all that is needed. We can now go to
|
|
|
d71fdb |
- the code above that handles numerical recursion, applying it to
|
|
|
d71fdb |
- the first group with the given name. */
|
|
|
d71fdb |
+ the code that handles numerical recursion, applying it to the first
|
|
|
d71fdb |
+ group with the given name. */
|
|
|
d71fdb |
|
|
|
d71fdb |
if (meta == META_RECURSE_BYNAME)
|
|
|
d71fdb |
{
|
|
|
d71fdb |
@@ -7286,6 +7286,8 @@ for (;; pptr++)
|
|
|
d71fdb |
groupsetfirstcu = FALSE;
|
|
|
d71fdb |
cb->had_recurse = TRUE;
|
|
|
d71fdb |
if (firstcuflags == REQ_UNSET) firstcuflags = REQ_NONE;
|
|
|
d71fdb |
+ zerofirstcu = firstcu;
|
|
|
d71fdb |
+ zerofirstcuflags = firstcuflags;
|
|
|
d71fdb |
break;
|
|
|
d71fdb |
|
|
|
d71fdb |
|
|
|
d71fdb |
diff --git a/testdata/testinput1 b/testdata/testinput1
|
|
|
d71fdb |
index d8615ee..fce38b2 100644
|
|
|
d71fdb |
--- a/testdata/testinput1
|
|
|
d71fdb |
+++ b/testdata/testinput1
|
|
|
d71fdb |
@@ -6263,4 +6263,19 @@ ef) x/x,mark
|
|
|
d71fdb |
aBCDEF
|
|
|
d71fdb |
AbCDe f
|
|
|
d71fdb |
|
|
|
d71fdb |
+/ (?<word> \w+ )* \. /xi
|
|
|
d71fdb |
+ pokus.
|
|
|
d71fdb |
+
|
|
|
d71fdb |
+/(?(DEFINE) (?<word> \w+ ) ) (?&word)* \./xi
|
|
|
d71fdb |
+ pokus.
|
|
|
d71fdb |
+
|
|
|
d71fdb |
+/(?(DEFINE) (?<word> \w+ ) ) ( (?&word)* ) \./xi
|
|
|
d71fdb |
+ pokus.
|
|
|
d71fdb |
+
|
|
|
d71fdb |
+/(?&word)* (?(DEFINE) (?<word> \w+ ) ) \./xi
|
|
|
d71fdb |
+ pokus.
|
|
|
d71fdb |
+
|
|
|
d71fdb |
+/(?&word)* \. (?<word> \w+ )/xi
|
|
|
d71fdb |
+ pokus.hokus
|
|
|
d71fdb |
+
|
|
|
d71fdb |
# End of testinput1
|
|
|
d71fdb |
diff --git a/testdata/testoutput1 b/testdata/testoutput1
|
|
|
d71fdb |
index 77b9ff0..ff88775 100644
|
|
|
d71fdb |
--- a/testdata/testoutput1
|
|
|
d71fdb |
+++ b/testdata/testoutput1
|
|
|
d71fdb |
@@ -9929,4 +9929,28 @@ No match
|
|
|
d71fdb |
AbCDe f
|
|
|
d71fdb |
No match
|
|
|
d71fdb |
|
|
|
d71fdb |
+/ (?<word> \w+ )* \. /xi
|
|
|
d71fdb |
+ pokus.
|
|
|
d71fdb |
+ 0: pokus.
|
|
|
d71fdb |
+ 1: pokus
|
|
|
d71fdb |
+
|
|
|
d71fdb |
+/(?(DEFINE) (?<word> \w+ ) ) (?&word)* \./xi
|
|
|
d71fdb |
+ pokus.
|
|
|
d71fdb |
+ 0: pokus.
|
|
|
d71fdb |
+
|
|
|
d71fdb |
+/(?(DEFINE) (?<word> \w+ ) ) ( (?&word)* ) \./xi
|
|
|
d71fdb |
+ pokus.
|
|
|
d71fdb |
+ 0: pokus.
|
|
|
d71fdb |
+ 1: <unset>
|
|
|
d71fdb |
+ 2: pokus
|
|
|
d71fdb |
+
|
|
|
d71fdb |
+/(?&word)* (?(DEFINE) (?<word> \w+ ) ) \./xi
|
|
|
d71fdb |
+ pokus.
|
|
|
d71fdb |
+ 0: pokus.
|
|
|
d71fdb |
+
|
|
|
d71fdb |
+/(?&word)* \. (?<word> \w+ )/xi
|
|
|
d71fdb |
+ pokus.hokus
|
|
|
d71fdb |
+ 0: pokus.hokus
|
|
|
d71fdb |
+ 1: hokus
|
|
|
d71fdb |
+
|
|
|
d71fdb |
# End of testinput1
|
|
|
d71fdb |
--
|
|
|
d71fdb |
2.17.2
|
|
|
d71fdb |
|