[Pcre-svn] [583] code/trunk: Fix pattern overrun in utf exte…

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [583] code/trunk: Fix pattern overrun in utf extended mode for a # comment that hit the end.
Revision: 583
          http://www.exim.org/viewvc/pcre2?view=rev&revision=583
Author:   ph10
Date:     2016-10-31 17:46:56 +0000 (Mon, 31 Oct 2016)
Log Message:
-----------
Fix pattern overrun in utf extended mode for a # comment that hit the end.


Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/src/pcre2_compile.c
    code/trunk/testdata/testinput5
    code/trunk/testdata/testoutput5


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2016-10-31 17:19:00 UTC (rev 582)
+++ code/trunk/ChangeLog    2016-10-31 17:46:56 UTC (rev 583)
@@ -113,11 +113,15 @@
 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
--------------------------


Modified: code/trunk/src/pcre2_compile.c
===================================================================
--- code/trunk/src/pcre2_compile.c    2016-10-31 17:19:00 UTC (rev 582)
+++ code/trunk/src/pcre2_compile.c    2016-10-31 17:46:56 UTC (rev 583)
@@ -2326,7 +2326,7 @@
           }
         ptr++;
 #ifdef SUPPORT_UNICODE
-        if (utf) FORWARDCHAR(ptr);
+        if (utf) FORWARDCHARTEST(ptr, ptrend);
 #endif
         }
       continue;  /* Next character in pattern */


Modified: code/trunk/testdata/testinput5
===================================================================
--- code/trunk/testdata/testinput5    2016-10-31 17:19:00 UTC (rev 582)
+++ code/trunk/testdata/testinput5    2016-10-31 17:46:56 UTC (rev 583)
@@ -1733,6 +1733,8 @@


/'(*UTF)'/hex

+/'#('/hex,extended,utf
+
/a(?<=A\XB)/utf

/ab(?<=A\RB)/utf

Modified: code/trunk/testdata/testoutput5
===================================================================
--- code/trunk/testdata/testoutput5    2016-10-31 17:19:00 UTC (rev 582)
+++ code/trunk/testdata/testoutput5    2016-10-31 17:46:56 UTC (rev 583)
@@ -4169,6 +4169,8 @@


/'(*UTF)'/hex

+/'#('/hex,extended,utf
+
/a(?<=A\XB)/utf
Failed: error 125 at offset 1: lookbehind assertion is not fixed length