From 223b0aaf60638cabbf4b1bf42b3fbf62da2e7428 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= Date: Fri, 19 Feb 2021 16:05:17 +0100 Subject: [PATCH] Fix a mismatch if \K was involved in a recursion --- ...-within-recursion-bug-in-interpreter.patch | 61 +++++++++++++++++++ pcre2.spec | 7 ++- 2 files changed, 67 insertions(+), 1 deletion(-) create mode 100644 pcre2-10.36-Fix-K-within-recursion-bug-in-interpreter.patch diff --git a/pcre2-10.36-Fix-K-within-recursion-bug-in-interpreter.patch b/pcre2-10.36-Fix-K-within-recursion-bug-in-interpreter.patch new file mode 100644 index 0000000..d8da57a --- /dev/null +++ b/pcre2-10.36-Fix-K-within-recursion-bug-in-interpreter.patch @@ -0,0 +1,61 @@ +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 + diff --git a/pcre2.spec b/pcre2.spec index d678ee1..772ba0d 100644 --- a/pcre2.spec +++ b/pcre2.spec @@ -9,7 +9,7 @@ #%%global rcversion RC1 Name: pcre2 Version: 10.36 -Release: %{?rcversion:0.}3%{?rcversion:.%rcversion}%{?dist} +Release: %{?rcversion:0.}4%{?rcversion:.%rcversion}%{?dist} %global myversion %{version}%{?rcversion:-%rcversion} Summary: Perl-compatible regular expression library # the library: BSD with exceptions @@ -58,6 +58,8 @@ Patch1: pcre2-10.36-Get-rid-of-gcc-fanalyzer-error-though-it-was-probabl.pat # a closing bracket as a quantifier, upstream bug #2690, in upstream after # 10.36 Patch2: pcre2-10.36-Fix-some-numerical-checking-bugs-Bugzilla-2690.patch +# Fix a mismatch if \K was involved in a recursion, in upstream after 10.36 +Patch3: pcre2-10.36-Fix-K-within-recursion-bug-in-interpreter.patch BuildRequires: autoconf BuildRequires: automake BuildRequires: coreutils @@ -261,6 +263,9 @@ make %{?_smp_mflags} check VERBOSE=yes %{_mandir}/man1/pcre2test.* %changelog +* Fri Feb 19 2021 Petr Pisar - 10.36-4 +- Fix a mismatch if \K was involved in a recursion + * Tue Feb 02 2021 Petr Pisar - 10.36-3 - Fix misparsing long numbers as a backreference and a number without a closing bracket as a quantifier (upstream bug #2690)