diff --git a/ChangeLog b/ChangeLog index 997eb1a..64c8e78 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 diff --git a/src/pcre2_compile.c b/src/pcre2_compile.c index b120ab0..64ebc0d 100644 --- a/src/pcre2_compile.c +++ b/src/pcre2_compile.c @@ -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 */ diff --git a/testdata/testinput5 b/testdata/testinput5 index 7e6e6a7..d9e606d 100644 --- a/testdata/testinput5 +++ b/testdata/testinput5 @@ -1731,6 +1731,8 @@ /'(*UTF)'/hex +/'#('/hex,extended,utf + /a(?<=A\XB)/utf /ab(?<=A\RB)/utf diff --git a/testdata/testoutput5 b/testdata/testoutput5 index bd85613..59cd744 100644 --- a/testdata/testoutput5 +++ b/testdata/testoutput5 @@ -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