diff --git a/ChangeLog b/ChangeLog index dffb29e65..6952632cb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2009-07-31 suzuki toshiya + + pcf: Fix some data types mismatching with their sources. + + * src/pcf/pcfdrivr.c (pcf_cmap_char_index): The type of + `code' is matched to PCF_Encoding->enc. + (pcf_cmap_char_next): The type of `charcode' is matched + to PCF_Encoding->enc. When *acharcode is set by charcode, + an overflow is checked and casted to unsigned 32-bit + integer. + 2009-07-31 suzuki toshiya bdf: Improve bdf_property_t.value names for LP64 platforms. diff --git a/src/pcf/pcfdrivr.c b/src/pcf/pcfdrivr.c index 245de8acf..edcd81f4e 100644 --- a/src/pcf/pcfdrivr.c +++ b/src/pcf/pcfdrivr.c @@ -111,7 +111,7 @@ THE SOFTWARE. while ( min < max ) { - FT_UInt32 code; + FT_ULong code; mid = ( min + max ) >> 1; @@ -140,7 +140,7 @@ THE SOFTWARE. PCF_CMap cmap = (PCF_CMap)pcfcmap; PCF_Encoding encodings = cmap->encodings; FT_UInt min, max, mid; - FT_UInt32 charcode = *acharcode + 1; + FT_ULong charcode = *acharcode + 1; FT_UInt result = 0; @@ -149,7 +149,7 @@ THE SOFTWARE. while ( min < max ) { - FT_UInt32 code; + FT_ULong code; mid = ( min + max ) >> 1; @@ -175,7 +175,14 @@ THE SOFTWARE. } Exit: - *acharcode = charcode; + if ( charcode > 0xFFFFFFFFUL ) + { + FT_TRACE1(( "pcf_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; }