ref: 660d651317f1693f8ee62714a260670c1fdc7c58
parent: 38e480b4c66b192e9661b060370c1c57483a1877
author: suzuki toshiya <[email protected]>
date: Fri Jul 31 20:30:21 EDT 2009
bdf: Fix some data types mismatching with their sources.
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
2009-07-31 suzuki toshiya <[email protected]>
+ bdf: Fix some data types mismatching with their sources.
+
+ * src/bdf/bdrdrivr.c (bdf_cmap_char_index): The type
+ of `code' is matched with BDF_encoding_el->enc.
+ (bdf_cmap_char_next): The type of `charcode' is
+ matched with BDF_encoding_el->enc. When *acharcode
+ is set by charcode, an overflow is checked and
+ casted to unsigned 32-bit integer.
+
+2009-07-31 suzuki toshiya <[email protected]>
+
autofit: Improve Unicode range definitions.
* src/autofit/aftypes.h (AF_UNIRANGE_REC): New macro
--- a/src/bdf/bdfdrivr.c
+++ b/src/bdf/bdfdrivr.c
@@ -101,7 +101,7 @@
while ( min < max )
{
- FT_UInt32 code;
+ FT_ULong code;
mid = ( min + max ) >> 1;
@@ -133,7 +133,7 @@
BDF_encoding_el* encodings = cmap->encodings;
FT_ULong min, max, mid; /* num_encodings */
FT_UShort result = 0; /* encodings->glyph */
- FT_UInt32 charcode = *acharcode + 1;
+ FT_ULong charcode = *acharcode + 1;
min = 0;
@@ -169,7 +169,14 @@
}
Exit:
- *acharcode = charcode;
+ if ( charcode > 0xFFFFFFFFUL )
+ {
+ FT_TRACE1(( "bdf_cmap_char_next: charcode 0x%x > 32bit API" ));
+ *acharcode = 0;
+ /* XXX: result should be changed to indicate an overflow error */
+ }
+ else
+ *acharcode = (FT_UInt32)charcode;
return result;
}