Revision: 1062
http://www.exim.org/viewvc/pcre2?view=rev&revision=1062
Author: ph10
Date: 2019-01-29 14:34:59 +0000 (Tue, 29 Jan 2019)
Log Message:
-----------
Fix bug in VERSION conditional test in DFA matching.
Modified Paths:
--------------
code/trunk/ChangeLog
code/trunk/src/pcre2_dfa_match.c
code/trunk/testdata/testinput6
code/trunk/testdata/testoutput6
Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog 2019-01-22 08:51:48 UTC (rev 1061)
+++ code/trunk/ChangeLog 2019-01-29 14:34:59 UTC (rev 1062)
@@ -114,7 +114,11 @@
28. Fix word boundary in JIT compiler. Patch by Mike Munday.
+29. The pcre2_dfa_match() function was incorrectly handling conditional version
+tests such as (?(VERSION>=0)...) when the version test was true. Incorrect
+processing or a crash could result.
+
Version 10.32 10-September-2018
-------------------------------
Modified: code/trunk/src/pcre2_dfa_match.c
===================================================================
--- code/trunk/src/pcre2_dfa_match.c 2019-01-22 08:51:48 UTC (rev 1061)
+++ code/trunk/src/pcre2_dfa_match.c 2019-01-29 14:34:59 UTC (rev 1062)
@@ -2760,7 +2760,7 @@
/* 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
Modified: code/trunk/testdata/testinput6
===================================================================
--- code/trunk/testdata/testinput6 2019-01-22 08:51:48 UTC (rev 1061)
+++ code/trunk/testdata/testinput6 2019-01-29 14:34:59 UTC (rev 1062)
@@ -4962,4 +4962,14 @@
/foobar/g
the foobar thing foobar again\=copy_matched_subject
+/(?(VERSION>=0)^B0W)/
+ B0W-W0W
+\= Expect no match
+ 0
+
+/(?(VERSION>=1000)^B0W|W0W)/
+ B0W-W0W
+\= Expect no match
+ 0
+
# End of testinput6
Modified: code/trunk/testdata/testoutput6
===================================================================
--- code/trunk/testdata/testoutput6 2019-01-22 08:51:48 UTC (rev 1061)
+++ code/trunk/testdata/testoutput6 2019-01-29 14:34:59 UTC (rev 1062)
@@ -7794,4 +7794,18 @@
0: foobar
0: foobar
+/(?(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