diff --git a/ChangeLog b/ChangeLog index 268dd6d1d..e3bf78116 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,25 @@ +2009-07-03 suzuki toshiya + + cache: Check higher bits in flags for non ILP32 systems. + + 4 public functions ought to take FT_ULong flags, but take + FT_UInt flags. To keep binary compatibility, we drop higher + bits on non ILP32 platforms, + ILP64 systems: No drop occurs. + LP64 systems: Higher bits are not used. + 16-bit systems: Drop can occur. + See + http://lists.gnu.org/archive/html/freetype-devel/2008-12/msg00065.html + These functions will be refined to take FT_ULong flags in + next bump with incompatible API change. + + * src/cache/ftcbasic.c (FTC_ImageCache_Lookup): + Check `flags' in `type', the 2nd argument. + (FTC_SBitCache_Lookup): Ditto. + (FTC_ImageCache_LookupScaler): Check `load_flags', + the 3rd argument. + (FTC_SBitCache_LookupScaler): Ditto. + 2009-07-03 suzuki toshiya sfnt: Ignore invalid GIDs in glyph name lookup. diff --git a/src/cache/ftcbasic.c b/src/cache/ftcbasic.c index 7539f55e1..e329d31fe 100644 --- a/src/cache/ftcbasic.c +++ b/src/cache/ftcbasic.c @@ -349,10 +349,16 @@ #endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ { + if ( (FT_ULong)(type->flags - FT_INT_MIN) > FT_UINT_MAX ) + { + FT_TRACE1(( "FTC_ImageCache_Lookup: higher bits in load_flags" )); + FT_TRACE1(( "0x%x are dropped\n", (type->flags & ~((FT_ULong)FT_UINT_MAX)) )); + } + query.attrs.scaler.face_id = type->face_id; query.attrs.scaler.width = type->width; query.attrs.scaler.height = type->height; - query.attrs.load_flags = type->flags; + query.attrs.load_flags = (FT_UInt)type->flags; } query.attrs.scaler.pixel = 1; @@ -418,8 +424,15 @@ if ( anode ) *anode = NULL; + /* FT_Load_Glyph(), FT_Load_Char() take FT_UInt flags */ + if ( load_flags > FT_UINT_MAX ) + { + FT_TRACE1(( "FTC_ImageCache_LookupScaler: higher bits in load_flags" )); + FT_TRACE1(( "0x%x are dropped\n", (load_flags & ~((FT_ULong)FT_UINT_MAX)) )); + } + query.attrs.scaler = scaler[0]; - query.attrs.load_flags = load_flags; + query.attrs.load_flags = (FT_UInt)load_flags; hash = FTC_BASIC_ATTR_HASH( &query.attrs ) + gindex; @@ -671,10 +684,16 @@ #endif /* FT_CONFIG_OPTION_OLD_INTERNALS */ { + if ( (FT_ULong)(type->flags - FT_INT_MIN) > FT_UINT_MAX ) + { + FT_TRACE1(( "FTC_ImageCache_Lookup: higher bits in load_flags" )); + FT_TRACE1(( "0x%x are dropped\n", (type->flags & ~((FT_ULong)FT_UINT_MAX)) )); + } + query.attrs.scaler.face_id = type->face_id; query.attrs.scaler.width = type->width; query.attrs.scaler.height = type->height; - query.attrs.load_flags = type->flags; + query.attrs.load_flags = (FT_UInt)type->flags; } query.attrs.scaler.pixel = 1; @@ -741,8 +760,15 @@ *ansbit = NULL; + /* FT_Load_Glyph(), FT_Load_Char() take FT_UInt flags */ + if ( load_flags > FT_UINT_MAX ) + { + FT_TRACE1(( "FTC_ImageCache_LookupScaler: higher bits in load_flags" )); + FT_TRACE1(( "0x%x are dropped\n", (load_flags & ~((FT_ULong)FT_UINT_MAX)) )); + } + query.attrs.scaler = scaler[0]; - query.attrs.load_flags = load_flags; + query.attrs.load_flags = (FT_UInt)load_flags; /* beware, the hash must be the same for all glyph ranges! */ hash = FTC_BASIC_ATTR_HASH( &query.attrs ) +