Commit 2a33275e3af01defc9230aa4b93a6b421cff9861

Werner Lemberg 2010-01-05T10:27:15

Fix Savannah bug #28395. * src/truetype/ttdriver.c (Load_Glyph), src/type1/t1gload.c (T1_Loada_Glyph): Don't check `num_glyphs' if incremental interface is used.

diff --git a/ChangeLog b/ChangeLog
index 92de4ae..c80ffdb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2010-01-05  Werner Lemberg  <wl@gnu.org>
+
+	Fix Savannah bug #28395.
+
+	* src/truetype/ttdriver.c (Load_Glyph), src/type1/t1gload.c
+	(T1_Loada_Glyph): Don't check `num_glyphs' if incremental interface
+	is used.
+
 2010-01-05  Ken Sharp  <ken.sharp@artifex.com>
 
 	Make Type 1 `seac' operator work with incremental interface.
diff --git a/src/truetype/ttdriver.c b/src/truetype/ttdriver.c
index dca009a..d4978a9 100644
--- a/src/truetype/ttdriver.c
+++ b/src/truetype/ttdriver.c
@@ -4,7 +4,8 @@
 /*                                                                         */
 /*    TrueType font driver implementation (body).                          */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 by */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009    */
+/*            2010 by                                                      */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -298,7 +299,15 @@
     if ( !size )
       return TT_Err_Invalid_Size_Handle;
 
-    if ( !face || glyph_index >= (FT_UInt)face->num_glyphs )
+    if ( !face )
+      return TT_Err_Invalid_Argument;
+
+#ifdef FT_CONFIG_OPTION_INCREMENTAL
+    if ( glyph_index >= (FT_UInt)face->num_glyphs &&
+         !face->internal->incremental_interface   )
+#else
+    if ( glyph_index >= (FT_UInt)face->num_glyphs )
+#endif
       return TT_Err_Invalid_Argument;
 
     if ( load_flags & FT_LOAD_NO_HINTING )
diff --git a/src/type1/t1gload.c b/src/type1/t1gload.c
index 1658615..cc8288d 100644
--- a/src/type1/t1gload.c
+++ b/src/type1/t1gload.c
@@ -4,7 +4,7 @@
 /*                                                                         */
 /*    Type 1 Glyph Loader (body).                                          */
 /*                                                                         */
-/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009 by       */
+/*  Copyright 1996-2001, 2002, 2003, 2004, 2005, 2006, 2008, 2009, 2010 by */
 /*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
 /*                                                                         */
 /*  This file is part of the FreeType project, and may only be used,       */
@@ -287,7 +287,12 @@
 #endif
 
 
+#ifdef FT_CONFIG_OPTION_INCREMENTAL
+    if ( glyph_index >= (FT_UInt)face->root.num_glyphs &&
+         face->root.internal->incremental_interface    )
+#else
     if ( glyph_index >= (FT_UInt)face->root.num_glyphs )
+#endif /* FT_CONFIG_OPTION_INCREMENTAL */
     {
       error = T1_Err_Invalid_Argument;
       goto Exit;