Fix pattern overrun in utf extended mode for a # comment that hit the end.

This commit is contained in:
Philip.Hazel 2016-10-31 17:46:56 +00:00
parent 2aa482039a
commit 0ea3274a53
4 changed files with 12 additions and 4 deletions

View File

@ -113,9 +113,13 @@ only when PCRE2_NO_START_OPTIMIZE was *not* set:
when the POSIX API was in use.
17. Added --enable-fuzz-support to "configure", causing an non-installed
library containing a test function that can be called by fuzzers to be
compiled. A non-installed binary to run the test function locally, called
pcre2fuzzcheck is also compiled.
library containing a test function that can be called by fuzzers to be
compiled. A non-installed binary to run the test function locally, called
pcre2fuzzcheck is also compiled.
18. In UTF-8 or UTF-16 modes with PCRE2_EXTENDED (/x) set and a non-zero-
terminated pattern, if a # comment ran on to the end of the pattern, one or
more code units past the end were being read.
Version 10.22 29-July-2016

View File

@ -2326,7 +2326,7 @@ while (ptr < ptrend)
}
ptr++;
#ifdef SUPPORT_UNICODE
if (utf) FORWARDCHAR(ptr);
if (utf) FORWARDCHARTEST(ptr, ptrend);
#endif
}
continue; /* Next character in pattern */

2
testdata/testinput5 vendored
View File

@ -1731,6 +1731,8 @@
/'(*UTF)'/hex
/'#('/hex,extended,utf
/a(?<=A\XB)/utf
/ab(?<=A\RB)/utf

View File

@ -4167,6 +4167,8 @@ No match
/'(*UTF)'/hex
/'#('/hex,extended,utf
/a(?<=A\XB)/utf
Failed: error 125 at offset 1: lookbehind assertion is not fixed length