From 71eb916d79e8c4a42972de44d7c14a5ba4e5b2fc Mon Sep 17 00:00:00 2001 From: "Philip.Hazel" Date: Sat, 10 Aug 2019 11:34:50 +0000 Subject: [PATCH] Fix allusedtext bug, rightmost consulted character incorrect in negative lookaheads. --- ChangeLog | 4 ++++ src/pcre2_match.c | 1 + testdata/testinput15 | 4 ++++ testdata/testinput2 | 2 +- testdata/testoutput15 | 8 ++++++++ testdata/testoutput2 | 2 +- 6 files changed, 19 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 260ec79..65385a3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -129,6 +129,10 @@ that is remembered as a minimum length), the whole group's length was incorrectly recorded as 65535, leading to incorrect "no match" when start-up optimizations were in force. +29. The "rightmost consulted character" value was not always correct; in +particular, if a pattern ended with a negative lookahead, characters that were +inspected in that lookahead were not included. + Version 10.33 16-April-2019 --------------------------- diff --git a/src/pcre2_match.c b/src/pcre2_match.c index 26fc01e..4471183 100644 --- a/src/pcre2_match.c +++ b/src/pcre2_match.c @@ -5971,6 +5971,7 @@ in rrc. */ #define LBL(val) case val: goto L_RM##val; RETURN_SWITCH: +if (Feptr > mb->last_used_ptr) mb->last_used_ptr = Feptr; if (Frdepth == 0) return rrc; /* Exit from the top level */ F = (heapframe *)((char *)F - Fback_frame); /* Backtrack */ mb->cb->callout_flags |= PCRE2_CALLOUT_BACKTRACK; /* Note for callouts */ diff --git a/testdata/testinput15 b/testdata/testinput15 index 2cb712d..5dd6897 100644 --- a/testdata/testinput15 +++ b/testdata/testinput15 @@ -231,4 +231,8 @@ /(*LIMIT_HEAP=21)\[(a)]{60}/expand \[a]{60} +/b(? + abcz + 0: abcz + < >> + # End of testinput15 diff --git a/testdata/testoutput2 b/testdata/testoutput2 index 0fd2187..0803d9e 100644 --- a/testdata/testoutput2 +++ b/testdata/testoutput2 @@ -14803,7 +14803,7 @@ No match /abcd/null_context abcd\=null_context 0: abcd -\= Expect error +\= Expect error - not allowed together abcd\=null_context,find_limits ** Not allowed together: find_limits null_context abcd\=allusedtext,startchar