shithub: freetype+ttf2subf

Download patch

ref: eae89a7f07a8af7304ca258f77d74cd3a8af72ee
parent: be41d3e718f2537497ac1a2415ce7a31611b0246
author: suzuki toshiya <[email protected]>
date: Fri Jul 31 20:30:22 EDT 2009

pcf: Fix some data types mismatching with their sources.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
 2009-07-31  suzuki toshiya <[email protected]>
 
+	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 <[email protected]>
+
 	bdf: Improve bdf_property_t.value names for LP64 platforms.
 
 	* src/bdf/bdf.h: In bdf_property_t.value, the member
--- a/src/pcf/pcfdrivr.c
+++ b/src/pcf/pcfdrivr.c
@@ -111,7 +111,7 @@
 
     while ( min < max )
     {
-      FT_UInt32  code;
+      FT_ULong  code;
 
 
       mid  = ( min + max ) >> 1;
@@ -140,7 +140,7 @@
     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 @@
 
     while ( min < max )
     {
-      FT_UInt32  code;
+      FT_ULong  code;
 
 
       mid  = ( min + max ) >> 1;
@@ -175,7 +175,14 @@
     }
 
   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;
   }