Blame SOURCES/pcre2-10.32-Fix-zero-repeated-subroutine-call-at-start-of-patter.patch

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