From 1e78fb74388943447942b5aca9bcdb60c42d0977 Mon Sep 17 00:00:00 2001 From: ph10 Date: Tue, 27 Nov 2018 16:00:58 +0000 Subject: [PATCH] Fix non-recognition of anchoring when preceded by (*MARK) etc. 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@1048 6239d852-aaf2-0410-a92c-79f79f948069 Petr Písař : Ported to 10.32. Signed-off-by: Petr Písař --- src/pcre2_compile.c | 10 +++++++++- testdata/testinput2 | 6 ++++++ testdata/testoutput2 | 18 ++++++++++++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/pcre2_compile.c b/src/pcre2_compile.c index 50dfd47..12d9058 100644 --- a/src/pcre2_compile.c +++ b/src/pcre2_compile.c @@ -4421,6 +4421,14 @@ for (;;) code += GET(code, 1) + 1 + LINK_SIZE; break; + case OP_MARK: + case OP_COMMIT_ARG: + case OP_PRUNE_ARG: + case OP_SKIP_ARG: + case OP_THEN_ARG: + code += code[1] + PRIV(OP_lengths)[*code]; + break; + default: return code; } @@ -7287,7 +7295,7 @@ for (;; pptr++) cb->had_recurse = TRUE; if (firstcuflags == REQ_UNSET) firstcuflags = REQ_NONE; zerofirstcu = firstcu; - zerofirstcuflags = firstcuflags; + zerofirstcuflags = firstcuflags; break; diff --git a/testdata/testinput2 b/testdata/testinput2 index fc94b35..6164ebb 100644 --- a/testdata/testinput2 +++ b/testdata/testinput2 @@ -5505,4 +5505,10 @@ a)"xI bbc xbc +/(*:XX)^abc/I + +/(*COMMIT:XX)^abc/I + +/(*ACCEPT:XX)^abc/I + # End of testinput2 diff --git a/testdata/testoutput2 b/testdata/testoutput2 index ecf0d80..f90941f 100644 --- a/testdata/testoutput2 +++ b/testdata/testoutput2 @@ -16763,6 +16763,24 @@ Subject length lower bound = 1 0: b 0+ c +/(*:XX)^abc/I +Capturing subpattern count = 0 +Compile options: +Overall options: anchored +First code unit = 'a' +Subject length lower bound = 3 + +/(*COMMIT:XX)^abc/I +Capturing subpattern count = 0 +Compile options: +Overall options: anchored +First code unit = 'a' +Subject length lower bound = 3 + +/(*ACCEPT:XX)^abc/I +Capturing subpattern count = 0 +Subject length lower bound = 0 + # End of testinput2 Error -70: PCRE2_ERROR_BADDATA (unknown error number) Error -62: bad serialized data -- 2.17.2