From 1ef05f50d623582e8493ab49cfe0c243eed175c9 Mon Sep 17 00:00:00 2001 From: ph10 Date: Thu, 18 Feb 2021 09:46:08 +0000 Subject: [PATCH] Fix \K within recursion bug in interpreter. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn://vcs.exim.org/pcre2/code/trunk@1301 6239d852-aaf2-0410-a92c-79f79f948069 Petr Písař: Ported to 10.36. --- src/pcre2_match.c | 4 +++- testdata/testinput1 | 3 +++ testdata/testoutput1 | 4 ++++ 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 bb4ddb7..4cf1126 100644 --- a/testdata/testinput1 +++ b/testdata/testinput1 @@ -6429,4 +6429,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 05b310b..8d4c108 100644 --- a/testdata/testoutput1 +++ b/testdata/testoutput1 @@ -10188,4 +10188,8 @@ No match >a{65536< 0: a{65536 +/a\K.(?0)*/ + abac + 0: c + # End of testinput1 -- 2.26.2