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

@ -117,6 +117,10 @@ when the POSIX API was in use.
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