summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsuzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>2009-07-03 18:01:40 +0900
committersuzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>2009-07-03 18:01:40 +0900
commit7a95cd876a4343b22061b44b1290286e5fa42a16 (patch)
treee9aab52acb46c822fd9b1a5ed0812e4023c122cf
parent7c67ddbf033a6ad594fec57d52fb5924d0e541fe (diff)
downloadfreetype2-7a95cd876a4343b22061b44b1290286e5fa42a16.tar.gz
cache: Check higher bits in flags for non ILP32 systems.
-rw-r--r--ChangeLog22
-rw-r--r--src/cache/ftcbasic.c34
2 files changed, 52 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 268dd6d1d..e3bf78116 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,27 @@
2009-07-03 suzuki toshiya <mpsuzuki@hiroshima-u.ac.jp>
+ 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 <mpsuzuki@hiroshima-u.ac.jp>
+
sfnt: Ignore invalid GIDs in glyph name lookup.
* include/freetype/internal/fttrace.h:
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 ) +