Mon 06 Oct 2008 06:07:48 PM UTC, original submission:
In "ttcmap.c" (within FreeType 2.3.7) there are several instances of pointer to FT_UInt32 being cast as a *FT_UInt.
This is a problem in porting this to a machine with big endian 16 bit ints (in my case Renesas H8SX).
By taking a pointer to 32 bit big endian data and accessing this via 16 bit pointer, you are actually accessing the upper 16 bits of the 32 bit data.
While very poor practice, this will work in little endian machines or machines where int is 32 bits.
In some cases, the a FT_Uint is being assigned to FT_UInt32...here data is being accessed beyond the allocated space...this doesn't work in my system, nor would I expect it to work on any system where int is not 32bits.
Specific instances are:
tt_cmap4_char_index( TT_CMap cmap, FT_UInt32 char_code )
...
return tt_cmap4_char_map_linear( cmap, &char_code, 0 );
...
return tt_cmap4_char_map_binary( cmap, &char_code, 0 );
tt_cmap4_char_next( TT_CMap cmap, FT_UInt32 *pchar_code )
...
gindex = tt_cmap4_char_map_linear( cmap, pchar_code, 1 );
...
gindex = tt_cmap4_char_map_binary( cmap, pchar_code, 1 );
static FT_UInt*
tt_cmap14_get_nondef_chars( TT_CMap cmap,
FT_Byte *p,
FT_Memory memory )
FT_UInt32 *ret;
return ret;
FT_CALLBACK_DEF( FT_UInt32 * )
tt_cmap14_variant_chars( TT_CMap cmap,
FT_Memory memory,
FT_ULong variantSelector )
...
return tt_cmap14_get_nondef_chars( cmap, cmap->data +
...
return tt_cmap14_get_nondef_chars( cmap, cmap->data +
|