[Pcre-svn] [778] code/trunk: Refactor to avoid sanitize warn…

Top Page
Delete this message
Author: Subversion repository
Date:  
To: pcre-svn
Subject: [Pcre-svn] [778] code/trunk: Refactor to avoid sanitize warnings when accessing the variable size ovector in
Revision: 778
          http://www.exim.org/viewvc/pcre2?view=rev&revision=778
Author:   ph10
Date:     2017-05-10 19:21:03 +0100 (Wed, 10 May 2017)
Log Message:
-----------
Refactor to avoid sanitize warnings when accessing the variable size ovector in 
the backtracking frame. Fixes oss-fuzz issue 1465. Also make -bigstack in 
RunTest allocate a 64Mb stack for use with clang sanitizing.


Modified Paths:
--------------
    code/trunk/ChangeLog
    code/trunk/RunTest
    code/trunk/src/pcre2_match.c


Modified: code/trunk/ChangeLog
===================================================================
--- code/trunk/ChangeLog    2017-05-10 16:44:33 UTC (rev 777)
+++ code/trunk/ChangeLog    2017-05-10 18:21:03 UTC (rev 778)
@@ -38,6 +38,9 @@


   (f) Refactor some code in do_callout() to avoid picky compiler warnings about 
       negative indices. Fixes oss-fuzz issue 1454.
+      
+  (g) Similarly refactor the way the variable length ovector is addressed for
+      similar reasons. Fixes oss-fuzz issue 1465.



2. Now that pcre2_match() no longer uses recursive function calls (see above),
@@ -160,8 +163,11 @@
31. If more than one of "push", "pushcopy", or "pushtablescopy" were set in
pcre2test, a crash could occur.

+32. Make -bigstack in RunTest allocate a 64Mb stack (instead of 16 MB) so that
+all the tests can run with clang's sanitizing options.


+
Version 10.23 14-February-2017
------------------------------


Modified: code/trunk/RunTest
===================================================================
--- code/trunk/RunTest    2017-05-10 16:44:33 UTC (rev 777)
+++ code/trunk/RunTest    2017-05-10 18:21:03 UTC (rev 778)
@@ -321,7 +321,7 @@


$sim ./pcre2test -S 1 /dev/null /dev/null
if [ $? -eq 0 -a "$bigstack" != "" ] ; then
- setstack="-S 16"
+ setstack="-S 64"
else
setstack=""
fi

Modified: code/trunk/src/pcre2_match.c
===================================================================
--- code/trunk/src/pcre2_match.c    2017-05-10 16:44:33 UTC (rev 777)
+++ code/trunk/src/pcre2_match.c    2017-05-10 18:21:03 UTC (rev 778)
@@ -182,10 +182,16 @@
 #define Foffset_top        F->offset_top
 #define Foccu              F->occu
 #define Fop                F->op
-#define Fovector           F->ovector
 #define Freturn_id         F->return_id


+/* We need a cast for this one because F->ovector is a vector of size 2, at the
+end of the backtrack frame, but when there are capturing parentheses the space
+allocated is bigger so we want to be able to address more elements. Without the
+case, -fsanitize=undefined grumbles at this. */

+#define Fovector           ((PCRE2_SIZE *)(F->ovector))
+
+
 #ifdef DEBUG_FRAMES_DISPLAY
 /*************************************************
 *      Display current frames and contents       *