freetype-commit
[Top][All Lists]
Advanced

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

[freetype2] master 43061d6: * src/truetype/ttinterp.c (TT_RunIns): Adjus


From: Werner LEMBERG
Subject: [freetype2] master 43061d6: * src/truetype/ttinterp.c (TT_RunIns): Adjust loop detector limits.
Date: Fri, 20 Jan 2017 09:16:57 +0000 (UTC)

branch: master
commit 43061d6a93e760066fee56be18c44d994eaa214a
Author: Werner Lemberg <address@hidden>
Commit: Werner Lemberg <address@hidden>

    * src/truetype/ttinterp.c (TT_RunIns): Adjust loop detector limits.
---
 ChangeLog               |    4 ++++
 src/truetype/ttinterp.c |   16 +++++++++++-----
 2 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 6f9a9b8..0b61da7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2017-01-20  Werner Lemberg  <address@hidden>
+
+       * src/truetype/ttinterp.c (TT_RunIns): Adjust loop detector limits.
+
 2017-01-17  Werner Lemberg  <address@hidden>
 
        * include/freetype/ttnameid.h: Updated to OpenType 1.8.1.
diff --git a/src/truetype/ttinterp.c b/src/truetype/ttinterp.c
index 883a8ad..7179ffd 100644
--- a/src/truetype/ttinterp.c
+++ b/src/truetype/ttinterp.c
@@ -7611,15 +7611,21 @@
     /* the number of points in the current glyph (if applicable).        */
     /*                                                                   */
     /* The idea is that in real-world bytecode you either iterate over   */
-    /* all CVT entries, or over all points (or contours) of a glyph, and */
-    /* such iterations don't happen very often.                          */
+    /* all CVT entries (in the `prep' table), or over all points (or     */
+    /* contours, in the `glyf' table) of a glyph, and such iterations    */
+    /* don't happen very often.                                          */
     exc->loopcall_counter = 0;
     exc->neg_jump_counter = 0;
 
     /* The maximum values are heuristic. */
-    exc->loopcall_counter_max = FT_MAX( 100,
-                                        10 * ( exc->pts.n_points +
-                                               exc->cvtSize ) );
+    if ( exc->pts.n_points )
+      exc->loopcall_counter_max = FT_MAX( 50,
+                                          10 * exc->pts.n_points ) +
+                                  FT_MAX( 50,
+                                          exc->cvtSize / 10 );
+    else
+      exc->loopcall_counter_max = FT_MAX( 100,
+                                          5 * exc->cvtSize );
     FT_TRACE5(( "TT_RunIns: Limiting total number of loops in LOOPCALL"
                 " to %d\n", exc->loopcall_counter_max ));
 



reply via email to

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