From 225bd60220208b0908555701a0176b8a9561dbe0 Mon Sep 17 00:00:00 2001 From: ph10 Date: Tue, 29 Jan 2019 14:34:59 +0000 Subject: [PATCH] Fix bug in VERSION conditional test in DFA matching. 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@1062 6239d852-aaf2-0410-a92c-79f79f948069 Petr Písař: Ported to 10.32. Signed-off-by: Petr Písař --- src/pcre2_dfa_match.c | 2 +- testdata/testinput6 | 10 ++++++++++ testdata/testoutput6 | 14 ++++++++++++++ 3 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/pcre2_dfa_match.c b/src/pcre2_dfa_match.c index 818004d..1a7f19d 100644 --- a/src/pcre2_dfa_match.c +++ b/src/pcre2_dfa_match.c @@ -2757,7 +2757,7 @@ for (;;) /* There is also an always-true condition */ else if (condcode == OP_TRUE) - { ADD_ACTIVE(state_offset + LINK_SIZE + 2 + IMM2_SIZE, 0); } + { ADD_ACTIVE(state_offset + LINK_SIZE + 2, 0); } /* The only supported version of OP_RREF is for the value RREF_ANY, which means "test if in any recursion". We can't test for specifically diff --git a/testdata/testinput6 b/testdata/testinput6 index f7dedb2..684e029 100644 --- a/testdata/testinput6 +++ b/testdata/testinput6 @@ -4955,4 +4955,14 @@ \= Expect no match \na +/(?(VERSION>=0)^B0W)/ + B0W-W0W +\= Expect no match + 0 + +/(?(VERSION>=1000)^B0W|W0W)/ + B0W-W0W +\= Expect no match + 0 + # End of testinput6 diff --git a/testdata/testoutput6 b/testdata/testoutput6 index caec833..051248f 100644 --- a/testdata/testoutput6 +++ b/testdata/testoutput6 @@ -7783,4 +7783,18 @@ No match \na No match +/(?(VERSION>=0)^B0W)/ + B0W-W0W + 0: B0W +\= Expect no match + 0 +No match + +/(?(VERSION>=1000)^B0W|W0W)/ + B0W-W0W + 0: W0W +\= Expect no match + 0 +No match + # End of testinput6 -- 2.17.2