diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | pcre_compile.c | 2 | ||||
-rw-r--r-- | testdata/testinput1 | 15 | ||||
-rw-r--r-- | testdata/testoutput1 | 24 |
4 files changed, 46 insertions, 0 deletions
@@ -40,6 +40,11 @@ such as /(?(1)^())b/ or /(?(?=^))b/. 7. Fix subject buffer overread in JIT when UTF is disabled and \X or \R has a greater than 1 fixed quantifier. This issue was found by Yunho Kim. +8. If a pattern started with a subroutine call that had a quantifier with a +minimum of zero, an incorrect "match must start with this character" could be +recorded. Example: /(?&xxx)*ABC(?<xxx>XYZ)/ would (incorrectly) expect 'A' to +be the first character of a match. + Version 8.42 20-March-2018 -------------------------- diff --git a/pcre_compile.c b/pcre_compile.c index 6141fb3..079d30a 100644 --- a/pcre_compile.c +++ b/pcre_compile.c @@ -7642,6 +7642,8 @@ for (;; ptr++) /* Can't determine a first byte now */ if (firstcharflags == REQ_UNSET) firstcharflags = REQ_NONE; + zerofirstchar = firstchar; + zerofirstcharflags = firstcharflags; continue; diff --git a/testdata/testinput1 b/testdata/testinput1 index 5c23f41..02e4f48 100644 --- a/testdata/testinput1 +++ b/testdata/testinput1 @@ -5742,4 +5742,19 @@ AbcdCBefgBhiBqz /X+(?#comment)?/ >XXX< +/ (?<word> \w+ )* \. /xi + pokus. + +/(?(DEFINE) (?<word> \w+ ) ) (?&word)* \./xi + pokus. + +/(?(DEFINE) (?<word> \w+ ) ) ( (?&word)* ) \./xi + pokus. + +/(?&word)* (?(DEFINE) (?<word> \w+ ) ) \./xi + pokus. + +/(?&word)* \. (?<word> \w+ )/xi + pokus.hokus + /-- End of testinput1 --/ diff --git a/testdata/testoutput1 b/testdata/testoutput1 index eff8ecc..e6147e6 100644 --- a/testdata/testoutput1 +++ b/testdata/testoutput1 @@ -9446,4 +9446,28 @@ No match >XXX< 0: X +/ (?<word> \w+ )* \. /xi + pokus. + 0: pokus. + 1: pokus + +/(?(DEFINE) (?<word> \w+ ) ) (?&word)* \./xi + pokus. + 0: pokus. + +/(?(DEFINE) (?<word> \w+ ) ) ( (?&word)* ) \./xi + pokus. + 0: pokus. + 1: <unset> + 2: pokus + +/(?&word)* (?(DEFINE) (?<word> \w+ ) ) \./xi + pokus. + 0: pokus. + +/(?&word)* \. (?<word> \w+ )/xi + pokus.hokus + 0: pokus.hokus + 1: hokus + /-- End of testinput1 --/ |