Commit 6ab5624330877f27b786c3616907d01cf805edc5

Werner Lemberg 2003-06-04T07:59:58

* src/truetype/ttgload.c (load_truetype_glyph) [TT_CONFIG_OPTION_BYTECODE_INTERPRETER]: Call FT_GlyphLoader_CheckPoints before adding phantom points. This fixes a segfault bug with fonts (e.g. htst3.ttf) which have nested subglyphs more than one level deep. Reported by Anthony Fok. * include/freetype/config/ftoption.h: Define TT_CONFIG_OPTION_BYTECODE_INTERPRETER, TT_CONFIG_OPTION_COMPILE_UNPATENTED_HINTING, and TT_CONFIG_OPTION_FORCE_UNPATENTED_HINTING to make it the new default.

diff --git a/ChangeLog b/ChangeLog
index 997c728..578da91 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+2003-06-04  Werner Lemberg  <wl@gnu.org>
+
+	* src/truetype/ttgload.c (load_truetype_glyph)
+	[TT_CONFIG_OPTION_BYTECODE_INTERPRETER]: Call
+	FT_GlyphLoader_CheckPoints before adding phantom points.  This fixes
+	a segfault bug with fonts (e.g. htst3.ttf) which have nested
+	subglyphs more than one level deep.  Reported by Anthony Fok.
+
+	* include/freetype/config/ftoption.h: Define
+	TT_CONFIG_OPTION_BYTECODE_INTERPRETER,
+	TT_CONFIG_OPTION_COMPILE_UNPATENTED_HINTING, and
+	TT_CONFIG_OPTION_FORCE_UNPATENTED_HINTING to make it the new
+	default.
+
 2003-06-03  Werner Lemberg  <wl@gnu.org>
 
 	* src/autohint/ahhint.c (ah_hinter_hint_edges): Removed.  Just a
diff --git a/include/freetype/config/ftoption.h b/include/freetype/config/ftoption.h
index c55404b..21f2c9a 100644
--- a/include/freetype/config/ftoption.h
+++ b/include/freetype/config/ftoption.h
@@ -291,7 +291,7 @@ FT_BEGIN_HEADER
   /*   should define FT_DEBUG_MEMORY here.                                 */
   /*                                                                       */
   /*   Note that the memory debugger is only activated at runtime when     */
-  /*   when the _environment_ variable "FT_DEBUG_MEMORY" is also defined!  */
+  /*   when the _environment_ variable "FT2_DEBUG_MEMORY" is defined also! */
   /*                                                                       */
   /*   Do not #undef this macro here since the build system might define   */
   /*   it for certain configurations only.                                 */
@@ -399,18 +399,19 @@ FT_BEGIN_HEADER
   /*   Do not #undef this macro here, since the build system might         */
   /*   define it for certain configurations only.                          */
   /*                                                                       */
-/* #define  TT_CONFIG_OPTION_BYTECODE_INTERPRETER */
+#define TT_CONFIG_OPTION_BYTECODE_INTERPRETER
 
 
   /*************************************************************************/
   /*                                                                       */
-  /* Define TT_CONFIG_OPTION_COMPILE_UNPATENTED_HINTING to compile the     */
-  /* unpatented work-around hinting system.  You must define this if you   */
-  /* want either to force the use of the unpatented hinting system by also */
-  /* defining TT_CONFIG_OPTION_FORCE_UNPATENTED_HINTING, or if you want to */
-  /* select it at run time using the FT_PARAM_TAG_UNPATENTED_HINTING tag.  */
+  /* Define TT_CONFIG_OPTION_COMPILE_UNPATENTED_HINTING (in addition to    */
+  /* TT_CONFIG_OPTION_BYTECODE_INTERPRETER) to compile the unpatented      */
+  /* work-around hinting system.  You must define this if you want either  */
+  /* to force the use of the unpatented hinting system by also defining    */
+  /* TT_CONFIG_OPTION_FORCE_UNPATENTED_HINTING, or if you want to select   */
+  /* it at run time using the FT_PARAM_TAG_UNPATENTED_HINTING tag.         */
   /*                                                                       */
-/* #define TT_CONFIG_OPTION_COMPILE_UNPATENTED_HINTING */
+#define TT_CONFIG_OPTION_COMPILE_UNPATENTED_HINTING
 
 
   /*************************************************************************/
@@ -423,7 +424,7 @@ FT_BEGIN_HEADER
   /* For this to work you must also define                                 */
   /* TT_CONFIG_OPTION_COMPILE_UNPATENTED_HINTING.                          */
   /*                                                                       */
-/* #define TT_CONFIG_OPTION_FORCE_UNPATENTED_HINTING */
+#define TT_CONFIG_OPTION_FORCE_UNPATENTED_HINTING
 
 
   /*************************************************************************/
diff --git a/src/truetype/ttgload.c b/src/truetype/ttgload.c
index c66050d..82ad8ab 100644
--- a/src/truetype/ttgload.c
+++ b/src/truetype/ttgload.c
@@ -779,6 +779,7 @@
     FT_Bool               glyph_data_loaded = 0;
 #endif
 
+
     if ( recurse_count >= TT_MAX_COMPOSITE_RECURSE )
     {
       error = TT_Err_Invalid_Composite;
@@ -1279,6 +1280,10 @@
           if ( error )
             goto Fail;
 
+          error = FT_GlyphLoader_CheckPoints( gloader, num_points + 2, 0 );
+          if ( error )
+            goto Fail;
+
           /* prepare the execution context */
           tt_prepare_zone( &exec->pts, &gloader->base,
                            start_point, start_contour );