ref: 2a5831ec07855a5a45be814d9058b08ce3e2df9d
parent: b566d42aa0470683634174671ce652f385902a93
author: suzuki toshiya <[email protected]>
date: Fri Jul 31 20:30:19 EDT 2009
cache: Check 32-bit glyph index on 16-bit systems.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2009-07-31 suzuki toshiya <[email protected]>
+ cache: Check 32-bit glyph index on 16-bit systems.
+
+ * src/cache/ftcbasic.c (ftc_basic_family_get_count):
+ Check overflow caused by the face including large
+ number of glyphs > 64k.
+
+2009-07-31 suzuki toshiya <[email protected]>
+
cache: Fix some data types mismatching with their sources.
* src/cache/ftccache.c (ftc_cache_resize): The types of
--- a/src/cache/ftcbasic.c
+++ b/src/cache/ftcbasic.c
@@ -25,7 +25,9 @@
#include "ftccback.h"
#include "ftcerror.h"
+#define FT_COMPONENT trace_cache
+
#ifdef FT_CONFIG_OPTION_OLD_INTERNALS
/*
@@ -139,8 +141,15 @@
error = FTC_Manager_LookupFace( manager, family->attrs.scaler.face_id,
&face );
+
+ if ( (FT_ULong)face->num_glyphs > FT_UINT_MAX || 0 > face->num_glyphs )
+ {
+ FT_TRACE1(( "ftc_basic_family_get_count: too large number of glyphs " ));
+ FT_TRACE1(( "in this face, truncated\n", face->num_glyphs ));
+ }
+
if ( !error )
- result = face->num_glyphs;
+ result = (FT_UInt)face->num_glyphs;
return result;
}