freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2] master 24a1fcd: [truetype] Add TT_CONFIG_OPTION_MAX_RUNNABLE


From: Werner LEMBERG
Subject: [freetype2] master 24a1fcd: [truetype] Add TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES (#46208).
Date: Thu, 15 Oct 2015 19:50:53 +0000

branch: master
commit 24a1fcdfce4e3c1d83596c691b2d2545e380a46e
Author: Werner Lemberg <address@hidden>
Commit: Werner Lemberg <address@hidden>

    [truetype] Add TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES (#46208).
    
    * devel/ftoption.h, include/freetype/config/ftoption.h
    (TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES): New configuration macro.
    
    * src/truetype/ttinterp.c (MAX_RUNNABLE_OPCODES): Removed.
    (TT_RunIns): Updated.
---
 ChangeLog                          |   10 ++++++++++
 devel/ftoption.h                   |   11 +++++++++++
 include/freetype/config/ftoption.h |   11 +++++++++++
 src/truetype/ttinterp.c            |   11 +----------
 4 files changed, 33 insertions(+), 10 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index e5b0c45..a052aa0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
 2015-10-15  Werner Lemberg  <address@hidden>
 
+       [truetype] Add TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES (#46208).
+
+       * devel/ftoption.h, include/freetype/config/ftoption.h
+       (TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES): New configuration macro.
+
+       * src/truetype/ttinterp.c (MAX_RUNNABLE_OPCODES): Removed.
+       (TT_RunIns): Updated.
+
+2015-10-15  Werner Lemberg  <address@hidden>
+
        * src/truetype/ttinterp.c (TT_RunIns): Fix bytecode stack tracing.
 
        The used indices were off by 1.
diff --git a/devel/ftoption.h b/devel/ftoption.h
index d4d1245..0eb8324 100644
--- a/devel/ftoption.h
+++ b/devel/ftoption.h
@@ -693,6 +693,17 @@ FT_BEGIN_HEADER
 
 
   /*************************************************************************/
+  /*                                                                       */
+  /* Option TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES controls the maximum     */
+  /* number of bytecode instructions executed for a single run of the      */
+  /* bytecode interpreter, needed to prevent infinite loops.  You don't    */
+  /* want to change this except for very special situations (e.g., making  */
+  /* a library fuzzer spend less time to handle broken fonts).             */
+  /*                                                                       */
+#define TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES  1000000L
+
+
+  /*************************************************************************/
   /*************************************************************************/
   /****                                                                 ****/
   /****      T Y P E 1   D R I V E R    C O N F I G U R A T I O N       ****/
diff --git a/include/freetype/config/ftoption.h 
b/include/freetype/config/ftoption.h
index 4970945..270c566 100644
--- a/include/freetype/config/ftoption.h
+++ b/include/freetype/config/ftoption.h
@@ -693,6 +693,17 @@ FT_BEGIN_HEADER
 
 
   /*************************************************************************/
+  /*                                                                       */
+  /* Option TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES controls the maximum     */
+  /* number of bytecode instructions executed for a single run of the      */
+  /* bytecode interpreter, needed to prevent infinite loops.  You don't    */
+  /* want to change this except for very special situations (e.g., making  */
+  /* a library fuzzer spend less time to handle broken fonts).             */
+  /*                                                                       */
+#define TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES  1000000L
+
+
+  /*************************************************************************/
   /*************************************************************************/
   /****                                                                 ****/
   /****      T Y P E 1   D R I V E R    C O N F I G U R A T I O N       ****/
diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c
index 85e409e..1c1d7de 100644
--- a/src/truetype/ttinterp.c
+++ b/src/truetype/ttinterp.c
@@ -45,15 +45,6 @@
 #define FT_COMPONENT  trace_ttinterp
 
 
-  /*************************************************************************/
-  /*                                                                       */
-  /* In order to detect infinite loops in the code, we set up a counter    */
-  /* within the run loop.  A single stroke of interpretation is now        */
-  /* limited to a maximum number of opcodes defined below.                 */
-  /*                                                                       */
-#define MAX_RUNNABLE_OPCODES  1000000L
-
-
 #define SUBPIXEL_HINTING                                                     \
           ( ((TT_Driver)FT_FACE_DRIVER( exc->face ))->interpreter_version == \
             TT_INTERPRETER_VERSION_38 )
@@ -8230,7 +8221,7 @@
 
       /* increment instruction counter and check if we didn't */
       /* run this program for too long (e.g. infinite loops). */
-      if ( ++ins_counter > MAX_RUNNABLE_OPCODES )
+      if ( ++ins_counter > TT_CONFIG_OPTION_MAX_RUNNABLE_OPCODES )
         return FT_THROW( Execution_Too_Long );
 
     LSuiteLabel_:



reply via email to

[Prev in Thread] Current Thread [Next in Thread]