[gxvalid] Signedness fixes.

* src/gxvalid/gxvbsln.c, src/gxvalid/gxvcommn.c,
src/gxvalid/gxvcommn.h, src/gxvalid/gxvjust.c,
src/gxvalid/gxvkern.c, src/gxvalid/gxvlcar.c, src/gxvalid/gxvmort.c,
src/gxvalid/gxvmort1.c, src/gxvalid/gxvmort2.c,
src/gxvalid/gxvmorx.c, src/gxvalid/gxvmorx1.c,
src/gxvalid/gxvmorx2.c, src/gxvalid/gxvopbd.c,
src/gxvalid/gxvprop.c, src/gxvalid/gxvtrak.c: Apply.
This commit is contained in:
Werner Lemberg 2015-02-25 07:53:09 +01:00
parent 24e4e96aff
commit 17b6291d26
16 changed files with 68 additions and 54 deletions

View File

@ -1,3 +1,15 @@
2015-02-25 Werner Lemberg <wl@gnu.org>
[gxvalid] Signedness fixes.
* src/gxvalid/gxvbsln.c, src/gxvalid/gxvcommn.c,
src/gxvalid/gxvcommn.h, src/gxvalid/gxvjust.c,
src/gxvalid/gxvkern.c, src/gxvalid/gxvlcar.c, src/gxvalid/gxvmort.c,
src/gxvalid/gxvmort1.c, src/gxvalid/gxvmort2.c,
src/gxvalid/gxvmorx.c, src/gxvalid/gxvmorx1.c,
src/gxvalid/gxvmorx2.c, src/gxvalid/gxvopbd.c,
src/gxvalid/gxvprop.c, src/gxvalid/gxvtrak.c: Apply.
2015-02-25 Werner Lemberg <wl@gnu.org> 2015-02-25 Werner Lemberg <wl@gnu.org>
[cache] Signedness fixes. [cache] Signedness fixes.
@ -35,7 +47,7 @@
is a better choice for `hash' to hold a pointer than `FT_PtrDist' is a better choice for `hash' to hold a pointer than `FT_PtrDist'
(a.k.a. `ptrdiff_t'), especially since the latter is signed, (a.k.a. `ptrdiff_t'), especially since the latter is signed,
causing zillions of signedness warnings. [Note that `hash' was of causing zillions of signedness warnings. [Note that `hash' was of
type `FT_UInt32' before the change to `FT_PtrDist.] type `FT_UInt32' before the change to `FT_PtrDist'.]
Update all users. Update all users.
* src/cache/ftcbasic.c, src/cache/ftccache.c, src/cache/ftccmap.c, * src/cache/ftcbasic.c, src/cache/ftccache.c, src/cache/ftccmap.c,

View File

@ -227,7 +227,7 @@
FT_INVALID_DATA; FT_INVALID_DATA;
} }
else else
gxv_ctlPoint_validate( stdGlyph, (FT_Short)ctlPoint, gxvalid ); gxv_ctlPoint_validate( stdGlyph, ctlPoint, gxvalid );
} }
GXV_EXIT; GXV_EXIT;

View File

@ -202,7 +202,7 @@
*max = (FT_Byte)FT_MAX( *max, val ); *max = (FT_Byte)FT_MAX( *max, val );
} }
gxvalid->subtable_length = p - table; gxvalid->subtable_length = (FT_ULong)( p - table );
} }
@ -231,7 +231,7 @@
*max = (FT_Byte)FT_MAX( *max, val ); *max = (FT_Byte)FT_MAX( *max, val );
} }
gxvalid->subtable_length = p - table; gxvalid->subtable_length = (FT_ULong)( p - table );
} }
@ -367,7 +367,7 @@
if ( *nUnits_p == 0 ) if ( *nUnits_p == 0 )
*nUnits_p = binSrchHeader.nUnits; *nUnits_p = binSrchHeader.nUnits;
gxvalid->subtable_length = p - table; gxvalid->subtable_length = (FT_ULong)( p - table );
GXV_EXIT; GXV_EXIT;
} }
@ -449,7 +449,7 @@
gxvalid->lookupval_func( i, &value, gxvalid ); gxvalid->lookupval_func( i, &value, gxvalid );
} }
gxvalid->subtable_length = p - table; gxvalid->subtable_length = (FT_ULong)( p - table );
GXV_EXIT; GXV_EXIT;
} }
@ -486,7 +486,7 @@
p += unitSize; p += unitSize;
} }
gxvalid->subtable_length = p - table; gxvalid->subtable_length = (FT_ULong)( p - table );
} }
@ -555,7 +555,7 @@
gxv_LookupTable_fmt2_skip_endmarkers( p, unitSize, gxvalid ); gxv_LookupTable_fmt2_skip_endmarkers( p, unitSize, gxvalid );
p += gxvalid->subtable_length; p += gxvalid->subtable_length;
gxvalid->subtable_length = p - table; gxvalid->subtable_length = (FT_ULong)( p - table );
GXV_EXIT; GXV_EXIT;
} }
@ -636,7 +636,7 @@
gxv_LookupTable_fmt2_skip_endmarkers( p, unitSize, gxvalid ); gxv_LookupTable_fmt2_skip_endmarkers( p, unitSize, gxvalid );
p += gxvalid->subtable_length; p += gxvalid->subtable_length;
gxvalid->subtable_length = p - table; gxvalid->subtable_length = (FT_ULong)( p - table );
GXV_EXIT; GXV_EXIT;
} }
@ -657,7 +657,7 @@
p += unitSize; p += unitSize;
} }
gxvalid->subtable_length = p - table; gxvalid->subtable_length = (FT_ULong)( p - table );
} }
@ -709,7 +709,7 @@
gxv_LookupTable_fmt6_skip_endmarkers( p, unitSize, gxvalid ); gxv_LookupTable_fmt6_skip_endmarkers( p, unitSize, gxvalid );
p += gxvalid->subtable_length; p += gxvalid->subtable_length;
gxvalid->subtable_length = p - table; gxvalid->subtable_length = (FT_ULong)( p - table );
GXV_EXIT; GXV_EXIT;
} }
@ -746,7 +746,7 @@
gxvalid->lookupval_func( (FT_UShort)( firstGlyph + i ), &value, gxvalid ); gxvalid->lookupval_func( (FT_UShort)( firstGlyph + i ), &value, gxvalid );
} }
gxvalid->subtable_length = p - table; gxvalid->subtable_length = (FT_ULong)( p - table );
GXV_EXIT; GXV_EXIT;
} }
@ -795,7 +795,7 @@
func( p, limit, gxvalid ); func( p, limit, gxvalid );
p += gxvalid->subtable_length; p += gxvalid->subtable_length;
gxvalid->subtable_length = p - table; gxvalid->subtable_length = (FT_ULong)( p - table );
GXV_EXIT; GXV_EXIT;
} }
@ -844,7 +844,7 @@
FT_LOCAL_DEF( void ) FT_LOCAL_DEF( void )
gxv_ctlPoint_validate( FT_UShort gid, gxv_ctlPoint_validate( FT_UShort gid,
FT_Short ctl_point, FT_UShort ctl_point,
GXV_Validator gxvalid ) GXV_Validator gxvalid )
{ {
FT_Face face; FT_Face face;
@ -852,7 +852,7 @@
FT_GlyphSlot glyph; FT_GlyphSlot glyph;
FT_Outline outline; FT_Outline outline;
short n_points; FT_UShort n_points;
face = gxvalid->face; face = gxvalid->face;
@ -865,8 +865,7 @@
glyph = face->glyph; glyph = face->glyph;
outline = glyph->outline; outline = glyph->outline;
n_points = outline.n_points; n_points = (FT_UShort)outline.n_points;
if ( !( ctl_point < n_points ) ) if ( !( ctl_point < n_points ) )
FT_INVALID_DATA; FT_INVALID_DATA;
@ -1449,7 +1448,7 @@
GXV_TRACE(( "parsed: maxState=%d, maxEntry=%d\n", GXV_TRACE(( "parsed: maxState=%d, maxEntry=%d\n",
*maxState_p, *maxEntry_p )); *maxState_p, *maxEntry_p ));
*length_p = p - table; *length_p = (FT_ULong)( p - table );
GXV_EXIT; GXV_EXIT;
} }
@ -1550,7 +1549,7 @@
} }
Exit: Exit:
*length_p = p - table; *length_p = (FT_ULong)( p - table );
GXV_EXIT; GXV_EXIT;
} }
@ -1605,7 +1604,7 @@
else else
setup_func = gxv_XStateTable_subtable_setup; setup_func = gxv_XStateTable_subtable_setup;
setup_func( limit - table, setup_func( (FT_ULong)( limit - table ),
classTable, classTable,
stateArray, stateArray,
entryTable, entryTable,

View File

@ -404,7 +404,7 @@ FT_BEGIN_HEADER
FT_LOCAL( void ) FT_LOCAL( void )
gxv_ctlPoint_validate( FT_UShort gid, gxv_ctlPoint_validate( FT_UShort gid,
FT_Short ctl_point, FT_UShort ctl_point,
GXV_Validator gxvalid ); GXV_Validator gxvalid );

View File

@ -121,7 +121,7 @@
GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA ); GXV_SET_ERR_IF_PARANOID( FT_INVALID_DATA );
} }
gxvalid->subtable_length = p - table; gxvalid->subtable_length = (FT_ULong)( p - table );
} }
@ -143,7 +143,7 @@
p += gxvalid->subtable_length; p += gxvalid->subtable_length;
} }
gxvalid->subtable_length = p - table; gxvalid->subtable_length = (FT_ULong)( p - table );
} }
@ -168,7 +168,7 @@
p += gxvalid->subtable_length; p += gxvalid->subtable_length;
} }
gxvalid->subtable_length = p - table; gxvalid->subtable_length = (FT_ULong)( p - table );
GXV_EXIT; GXV_EXIT;
} }
@ -192,8 +192,8 @@
GXV_LIMIT_CHECK( 4 + 4 + 2 + 2 ); GXV_LIMIT_CHECK( 4 + 4 + 2 + 2 );
lowerLimit = FT_NEXT_ULONG( p ); lowerLimit = FT_NEXT_LONG( p );
upperLimit = FT_NEXT_ULONG( p ); upperLimit = FT_NEXT_LONG( p );
#ifdef GXV_LOAD_UNUSED_VARS #ifdef GXV_LOAD_UNUSED_VARS
order = FT_NEXT_USHORT( p ); order = FT_NEXT_USHORT( p );
#else #else
@ -218,7 +218,7 @@
gxv_just_check_max_gid( glyphs, "type0:glyphs", gxvalid ); gxv_just_check_max_gid( glyphs, "type0:glyphs", gxvalid );
} }
gxvalid->subtable_length = p - table; gxvalid->subtable_length = (FT_ULong)( p - table );
} }
@ -236,7 +236,7 @@
gxv_just_check_max_gid( addGlyph, "type1:addGlyph", gxvalid ); gxv_just_check_max_gid( addGlyph, "type1:addGlyph", gxvalid );
gxvalid->subtable_length = p - table; gxvalid->subtable_length = (FT_ULong)( p - table );
} }
@ -267,7 +267,7 @@
gxv_just_check_max_gid( substGlyph, "type2:substGlyph", gxvalid ); gxv_just_check_max_gid( substGlyph, "type2:substGlyph", gxvalid );
gxvalid->subtable_length = p - table; gxvalid->subtable_length = (FT_ULong)( p - table );
} }
@ -285,11 +285,11 @@
GXV_LIMIT_CHECK( 4 + 4 + 4 + 4 ); GXV_LIMIT_CHECK( 4 + 4 + 4 + 4 );
variantsAxis = FT_NEXT_ULONG( p ); variantsAxis = FT_NEXT_ULONG( p );
minimumLimit = FT_NEXT_ULONG( p ); minimumLimit = FT_NEXT_LONG( p );
noStretchValue = FT_NEXT_ULONG( p ); noStretchValue = FT_NEXT_LONG( p );
maximumLimit = FT_NEXT_ULONG( p ); maximumLimit = FT_NEXT_LONG( p );
gxvalid->subtable_length = p - table; gxvalid->subtable_length = (FT_ULong)( p - table );
if ( variantsAxis != 0x64756374L ) /* 'duct' */ if ( variantsAxis != 0x64756374L ) /* 'duct' */
GXV_TRACE(( "variantsAxis 0x%08x is non default value", GXV_TRACE(( "variantsAxis 0x%08x is non default value",
@ -327,7 +327,7 @@
flags )); flags ));
gxv_just_check_max_gid( glyph, "type5:glyph", gxvalid ); gxv_just_check_max_gid( glyph, "type5:glyph", gxvalid );
gxvalid->subtable_length = p - table; gxvalid->subtable_length = (FT_ULong)( p - table );
} }
@ -395,7 +395,7 @@
p += gxvalid->subtable_length; p += gxvalid->subtable_length;
} }
gxvalid->subtable_length = p - table; gxvalid->subtable_length = (FT_ULong)( p - table );
GXV_EXIT; GXV_EXIT;
} }
@ -454,7 +454,7 @@
gxv_just_pcActionRecord_validate( p, limit, gxvalid ); gxv_just_pcActionRecord_validate( p, limit, gxvalid );
p += gxvalid->subtable_length; p += gxvalid->subtable_length;
gxvalid->subtable_length = p - table; gxvalid->subtable_length = (FT_ULong)( p - table );
GXV_EXIT; GXV_EXIT;
} }
@ -677,7 +677,8 @@
format = FT_NEXT_USHORT( p ); format = FT_NEXT_USHORT( p );
horizOffset = FT_NEXT_USHORT( p ); horizOffset = FT_NEXT_USHORT( p );
vertOffset = FT_NEXT_USHORT( p ); vertOffset = FT_NEXT_USHORT( p );
gxv_odtect_add_range( table, p - table, "just header", odtect ); gxv_odtect_add_range( table, (FT_ULong)( p - table ),
"just header", odtect );
/* Version 1.0 (always:2000) */ /* Version 1.0 (always:2000) */

View File

@ -549,7 +549,7 @@
} }
} }
gxvalid->subtable_length = p - table; gxvalid->subtable_length = (FT_ULong)( p - table );
GXV_EXIT; GXV_EXIT;
} }
@ -779,7 +779,7 @@
#ifdef GXV_LOAD_TRACE_VARS #ifdef GXV_LOAD_TRACE_VARS
version = 0; version = 0;
#endif #endif
length = ( u16[0] << 16 ) + u16[1]; length = ( (FT_ULong)u16[0] << 16 ) + u16[1];
#ifdef GXV_LOAD_TRACE_VARS #ifdef GXV_LOAD_TRACE_VARS
tupleIndex = 0; tupleIndex = 0;
#endif #endif

View File

@ -66,7 +66,7 @@
/*************************************************************************/ /*************************************************************************/
static void static void
gxv_lcar_partial_validate( FT_UShort partial, gxv_lcar_partial_validate( FT_Short partial,
FT_UShort glyph, FT_UShort glyph,
GXV_Validator gxvalid ) GXV_Validator gxvalid )
{ {
@ -75,7 +75,7 @@
if ( GXV_LCAR_DATA( format ) != 1 ) if ( GXV_LCAR_DATA( format ) != 1 )
goto Exit; goto Exit;
gxv_ctlPoint_validate( glyph, partial, gxvalid ); gxv_ctlPoint_validate( glyph, (FT_UShort)partial, gxvalid );
Exit: Exit:
GXV_EXIT; GXV_EXIT;
@ -203,7 +203,7 @@
GXV_INIT; GXV_INIT;
GXV_LIMIT_CHECK( 4 + 2 ); GXV_LIMIT_CHECK( 4 + 2 );
version = FT_NEXT_ULONG( p ); version = FT_NEXT_LONG( p );
GXV_LCAR_DATA( format ) = FT_NEXT_USHORT( p ); GXV_LCAR_DATA( format ) = FT_NEXT_USHORT( p );
if ( version != 0x00010000UL) if ( version != 0x00010000UL)

View File

@ -113,7 +113,7 @@
if ( !IS_GXV_MORT_FEATURE_OFF( f ) ) if ( !IS_GXV_MORT_FEATURE_OFF( f ) )
FT_INVALID_DATA; FT_INVALID_DATA;
gxvalid->subtable_length = p - table; gxvalid->subtable_length = (FT_ULong)( p - table );
GXV_EXIT; GXV_EXIT;
} }
@ -214,7 +214,7 @@
/* TODO: validate subFeatureFlags */ /* TODO: validate subFeatureFlags */
} }
gxvalid->subtable_length = p - table; gxvalid->subtable_length = (FT_ULong)( p - table );
GXV_EXIT; GXV_EXIT;
} }

View File

@ -156,7 +156,7 @@
setMark = (FT_UShort)( flags >> 15 ); setMark = (FT_UShort)( flags >> 15 );
dontAdvance = (FT_UShort)( ( flags >> 14 ) & 1 ); dontAdvance = (FT_UShort)( ( flags >> 14 ) & 1 );
#endif #endif
reserved = (FT_Short)( flags & 0x3FFF ); reserved = (FT_UShort)( flags & 0x3FFF );
markOffset = (FT_Short)( glyphOffset_p->ul >> 16 ); markOffset = (FT_Short)( glyphOffset_p->ul >> 16 );
currentOffset = (FT_Short)( glyphOffset_p->ul ); currentOffset = (FT_Short)( glyphOffset_p->ul );

View File

@ -303,7 +303,7 @@
p += gxvalid->subtable_length; p += gxvalid->subtable_length;
gxv_mort_subtable_type2_ligatureTable_validate( table, gxvalid ); gxv_mort_subtable_type2_ligatureTable_validate( table, gxvalid );
gxvalid->subtable_length = p - table; gxvalid->subtable_length = (FT_ULong)( p - table );
GXV_EXIT; GXV_EXIT;
} }

View File

@ -107,7 +107,7 @@
p += rest; p += rest;
} }
gxvalid->subtable_length = p - table; gxvalid->subtable_length = (FT_ULong)( p - table );
GXV_EXIT; GXV_EXIT;
} }

View File

@ -149,11 +149,11 @@
if ( optdata->substitutionTable_num_lookupTables < markIndex + 1 ) if ( optdata->substitutionTable_num_lookupTables < markIndex + 1 )
optdata->substitutionTable_num_lookupTables = optdata->substitutionTable_num_lookupTables =
(FT_Short)( markIndex + 1 ); (FT_UShort)( markIndex + 1 );
if ( optdata->substitutionTable_num_lookupTables < currentIndex + 1 ) if ( optdata->substitutionTable_num_lookupTables < currentIndex + 1 )
optdata->substitutionTable_num_lookupTables = optdata->substitutionTable_num_lookupTables =
(FT_Short)( currentIndex + 1 ); (FT_UShort)( currentIndex + 1 );
} }

View File

@ -189,7 +189,8 @@
/* it is different from the location offset in mort */ /* it is different from the location offset in mort */
if ( ( offset & 0x3FFF0000UL ) == 0x3FFF0000UL ) if ( ( offset & 0x3FFF0000UL ) == 0x3FFF0000UL )
{ /* negative offset */ { /* negative offset */
gid_limit = gxvalid->face->num_glyphs - ( offset & 0x0000FFFFUL ); gid_limit = gxvalid->face->num_glyphs -
(FT_Long)( offset & 0x0000FFFFUL );
if ( gid_limit > 0 ) if ( gid_limit > 0 )
return; return;

View File

@ -91,7 +91,7 @@
if ( delta_value == -1 ) if ( delta_value == -1 )
continue; continue;
gxv_ctlPoint_validate( glyph, delta_value, gxvalid ); gxv_ctlPoint_validate( glyph, (FT_UShort)delta_value, gxvalid );
} }
else /* format 0, value is distance */ else /* format 0, value is distance */
continue; continue;

View File

@ -279,7 +279,7 @@
GXV_INIT; GXV_INIT;
GXV_LIMIT_CHECK( 4 + 2 + 2 ); GXV_LIMIT_CHECK( 4 + 2 + 2 );
version = FT_NEXT_ULONG( p ); version = FT_NEXT_LONG( p );
format = FT_NEXT_USHORT( p ); format = FT_NEXT_USHORT( p );
defaultProp = FT_NEXT_USHORT( p ); defaultProp = FT_NEXT_USHORT( p );

View File

@ -135,7 +135,7 @@
} }
} }
gxvalid->subtable_length = p - table; gxvalid->subtable_length = (FT_ULong)( p - table );
GXV_EXIT; GXV_EXIT;
} }
@ -162,7 +162,8 @@
nSizes = FT_NEXT_USHORT( p ); nSizes = FT_NEXT_USHORT( p );
sizeTableOffset = FT_NEXT_ULONG( p ); sizeTableOffset = FT_NEXT_ULONG( p );
gxv_odtect_add_range( table, p - table, "trackData header", odtect ); gxv_odtect_add_range( table, (FT_ULong)( p - table ),
"trackData header", odtect );
/* validate trackTable */ /* validate trackTable */
gxv_trak_trackTable_validate( p, limit, nTracks, gxvalid ); gxv_trak_trackTable_validate( p, limit, nTracks, gxvalid );