Date: Thu, 18 Feb 2021 09:46:08 +0000
Subject: [PATCH] Fix \K within recursion bug in interpreter.

Conflict:delete Changelog
Reference:https://github.com/PhilipHazel/pcre2/commit/2c4d3942e4dd0dbbfccc43b9cb28d8258afaaca4

---
 src/pcre2_match.c    | 4 +++-
 testdata/testinput1  | 3 +++
 testdata/testoutput1 | 4 ++++
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/pcre2_match.c b/src/pcre2_match.c
index e3f78c2..7d9cad0 100644
--- a/src/pcre2_match.c
+++ b/src/pcre2_match.c
@@ -818,10 +818,12 @@ fprintf(stderr, "++ op=%d\n", *Fecode);
 
       /* N is now the frame of the recursion; the previous frame is at the
       OP_RECURSE position. Go back there, copying the current subject position
-      and mark, and move on past the OP_RECURSE. */
+      and mark, and the start_match position (\K might have changed it), and
+      then move on past the OP_RECURSE. */
 
       P->eptr = Feptr;
       P->mark = Fmark;
+      P->start_match = Fstart_match; 
       F = P;
       Fecode += 1 + LINK_SIZE;
       continue;
diff --git a/testdata/testinput1 b/testdata/testinput1
index 8409791..ae1e17e 100644
--- a/testdata/testinput1
+++ b/testdata/testinput1
@@ -6436,4 +6436,7 @@ ef) x/x,mark
 /a{65536/
     >a{65536<
 
+/a\K.(?0)*/
+    abac
+
 # End of testinput1 
diff --git a/testdata/testoutput1 b/testdata/testoutput1
index 666ae8c..a65eb0e 100644
--- a/testdata/testoutput1
+++ b/testdata/testoutput1
@@ -10198,4 +10198,8 @@ No match
     >a{65536<
  0: a{65536
 
+/a\K.(?0)*/
+    abac
+ 0: c
+
 # End of testinput1 
-- 
2.27.0

