[psaux] Signedness revisions.
Unsigned indexes are easier to check. * src/psaux/cffdecode.c (cff_decoder_parse_charstrings): Updated. * src/psaux/psintrp.c (cf2_interpT2CharString): Ditto. * src/psaux/t1decode.c (t1_decoder_parse_charstrings): Ditto. * src/type1/t1load.c (read_binary_data): Ditto.
This commit is contained in:
parent
3b036820d6
commit
77bd46e959
|
@ -1871,7 +1871,7 @@
|
||||||
case cff_op_put:
|
case cff_op_put:
|
||||||
{
|
{
|
||||||
FT_Fixed val = args[0];
|
FT_Fixed val = args[0];
|
||||||
FT_Int idx = (FT_Int)( args[1] >> 16 );
|
FT_UInt idx = (FT_UInt)( args[1] >> 16 );
|
||||||
|
|
||||||
|
|
||||||
FT_TRACE4(( " put\n" ));
|
FT_TRACE4(( " put\n" ));
|
||||||
|
@ -1880,20 +1880,20 @@
|
||||||
/* didn't give a hard-coded size limit of the temporary */
|
/* didn't give a hard-coded size limit of the temporary */
|
||||||
/* storage array; instead, an argument of the */
|
/* storage array; instead, an argument of the */
|
||||||
/* `MultipleMaster' operator set the size */
|
/* `MultipleMaster' operator set the size */
|
||||||
if ( idx >= 0 && idx < CFF_MAX_TRANS_ELEMENTS )
|
if ( idx < CFF_MAX_TRANS_ELEMENTS )
|
||||||
decoder->buildchar[idx] = val;
|
decoder->buildchar[idx] = val;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case cff_op_get:
|
case cff_op_get:
|
||||||
{
|
{
|
||||||
FT_Int idx = (FT_Int)( args[0] >> 16 );
|
FT_UInt idx = (FT_UInt)( args[0] >> 16 );
|
||||||
FT_Fixed val = 0;
|
FT_Fixed val = 0;
|
||||||
|
|
||||||
|
|
||||||
FT_TRACE4(( " get\n" ));
|
FT_TRACE4(( " get\n" ));
|
||||||
|
|
||||||
if ( idx >= 0 && idx < CFF_MAX_TRANS_ELEMENTS )
|
if ( idx < CFF_MAX_TRANS_ELEMENTS )
|
||||||
val = decoder->buildchar[idx];
|
val = decoder->buildchar[idx];
|
||||||
|
|
||||||
args[0] = val;
|
args[0] = val;
|
||||||
|
@ -1914,9 +1914,9 @@
|
||||||
/* this operator was removed from the Type2 specification */
|
/* this operator was removed from the Type2 specification */
|
||||||
/* in version 16-March-2000 */
|
/* in version 16-March-2000 */
|
||||||
{
|
{
|
||||||
FT_Int reg_idx = (FT_Int)args[0];
|
FT_UInt reg_idx = (FT_UInt)args[0];
|
||||||
FT_Int idx = (FT_Int)args[1];
|
FT_UInt idx = (FT_UInt)args[1];
|
||||||
FT_Int count = (FT_Int)args[2];
|
FT_UInt count = (FT_UInt)args[2];
|
||||||
|
|
||||||
|
|
||||||
FT_TRACE4(( " load\n" ));
|
FT_TRACE4(( " load\n" ));
|
||||||
|
@ -1924,11 +1924,11 @@
|
||||||
/* since we currently don't handle interpolation of multiple */
|
/* since we currently don't handle interpolation of multiple */
|
||||||
/* master fonts, we store a vector [1 0 0 ...] in the */
|
/* master fonts, we store a vector [1 0 0 ...] in the */
|
||||||
/* temporary storage array regardless of the Registry index */
|
/* temporary storage array regardless of the Registry index */
|
||||||
if ( reg_idx >= 0 && reg_idx <= 2 &&
|
if ( reg_idx <= 2 &&
|
||||||
idx >= 0 && idx < CFF_MAX_TRANS_ELEMENTS &&
|
idx < CFF_MAX_TRANS_ELEMENTS &&
|
||||||
count >= 0 && count <= num_axes )
|
count <= num_axes )
|
||||||
{
|
{
|
||||||
FT_Int end, i;
|
FT_UInt end, i;
|
||||||
|
|
||||||
|
|
||||||
end = FT_MIN( idx + count, CFF_MAX_TRANS_ELEMENTS );
|
end = FT_MIN( idx + count, CFF_MAX_TRANS_ELEMENTS );
|
||||||
|
|
|
@ -1899,17 +1899,16 @@
|
||||||
/* cvi( <idx> ) of BuildCharArray with */
|
/* cvi( <idx> ) of BuildCharArray with */
|
||||||
/* WeightVector */
|
/* WeightVector */
|
||||||
{
|
{
|
||||||
FT_Int idx;
|
FT_UInt idx;
|
||||||
PS_Blend blend = decoder->blend;
|
PS_Blend blend = decoder->blend;
|
||||||
|
|
||||||
|
|
||||||
if ( arg_cnt != 1 || !blend )
|
if ( arg_cnt != 1 || !blend )
|
||||||
goto Unexpected_OtherSubr;
|
goto Unexpected_OtherSubr;
|
||||||
|
|
||||||
idx = cf2_stack_popInt( opStack );
|
idx = (FT_UInt)cf2_stack_popInt( opStack );
|
||||||
|
|
||||||
if ( idx < 0 ||
|
if ( idx + blend->num_designs >
|
||||||
(FT_UInt)idx + blend->num_designs >
|
|
||||||
decoder->len_buildchar )
|
decoder->len_buildchar )
|
||||||
goto Unexpected_OtherSubr;
|
goto Unexpected_OtherSubr;
|
||||||
|
|
||||||
|
@ -2010,17 +2009,16 @@
|
||||||
/* <val> <idx> 2 24 callothersubr */
|
/* <val> <idx> 2 24 callothersubr */
|
||||||
/* ==> set BuildCharArray[cvi( <idx> )] = <val> */
|
/* ==> set BuildCharArray[cvi( <idx> )] = <val> */
|
||||||
{
|
{
|
||||||
CF2_Int idx;
|
CF2_UInt idx;
|
||||||
PS_Blend blend = decoder->blend;
|
PS_Blend blend = decoder->blend;
|
||||||
|
|
||||||
|
|
||||||
if ( arg_cnt != 2 || !blend )
|
if ( arg_cnt != 2 || !blend )
|
||||||
goto Unexpected_OtherSubr;
|
goto Unexpected_OtherSubr;
|
||||||
|
|
||||||
idx = cf2_stack_popInt( opStack );
|
idx = (CF2_UInt)cf2_stack_popInt( opStack );
|
||||||
|
|
||||||
if ( idx < 0 ||
|
if ( idx >= decoder->len_buildchar )
|
||||||
(FT_UInt)idx >= decoder->len_buildchar )
|
|
||||||
goto Unexpected_OtherSubr;
|
goto Unexpected_OtherSubr;
|
||||||
|
|
||||||
decoder->buildchar[idx] =
|
decoder->buildchar[idx] =
|
||||||
|
@ -2033,17 +2031,16 @@
|
||||||
/* ==> push BuildCharArray[cvi( idx )] */
|
/* ==> push BuildCharArray[cvi( idx )] */
|
||||||
/* onto T1 stack */
|
/* onto T1 stack */
|
||||||
{
|
{
|
||||||
CF2_Int idx;
|
CF2_UInt idx;
|
||||||
PS_Blend blend = decoder->blend;
|
PS_Blend blend = decoder->blend;
|
||||||
|
|
||||||
|
|
||||||
if ( arg_cnt != 1 || !blend )
|
if ( arg_cnt != 1 || !blend )
|
||||||
goto Unexpected_OtherSubr;
|
goto Unexpected_OtherSubr;
|
||||||
|
|
||||||
idx = cf2_stack_popInt( opStack );
|
idx = (CF2_UInt)cf2_stack_popInt( opStack );
|
||||||
|
|
||||||
if ( idx < 0 ||
|
if ( idx >= decoder->len_buildchar )
|
||||||
(FT_UInt)idx >= decoder->len_buildchar )
|
|
||||||
goto Unexpected_OtherSubr;
|
goto Unexpected_OtherSubr;
|
||||||
|
|
||||||
cf2_stack_pushFixed( opStack,
|
cf2_stack_pushFixed( opStack,
|
||||||
|
@ -2185,29 +2182,29 @@
|
||||||
case cf2_escPUT:
|
case cf2_escPUT:
|
||||||
{
|
{
|
||||||
CF2_F16Dot16 val;
|
CF2_F16Dot16 val;
|
||||||
CF2_Int idx;
|
CF2_UInt idx;
|
||||||
|
|
||||||
|
|
||||||
FT_TRACE4(( " put\n" ));
|
FT_TRACE4(( " put\n" ));
|
||||||
|
|
||||||
idx = cf2_stack_popInt( opStack );
|
idx = (CF2_UInt)cf2_stack_popInt( opStack );
|
||||||
val = cf2_stack_popFixed( opStack );
|
val = cf2_stack_popFixed( opStack );
|
||||||
|
|
||||||
if ( idx >= 0 && idx < CF2_STORAGE_SIZE )
|
if ( idx < CF2_STORAGE_SIZE )
|
||||||
storage[idx] = val;
|
storage[idx] = val;
|
||||||
}
|
}
|
||||||
continue; /* do not clear the stack */
|
continue; /* do not clear the stack */
|
||||||
|
|
||||||
case cf2_escGET:
|
case cf2_escGET:
|
||||||
{
|
{
|
||||||
CF2_Int idx;
|
CF2_UInt idx;
|
||||||
|
|
||||||
|
|
||||||
FT_TRACE4(( " get\n" ));
|
FT_TRACE4(( " get\n" ));
|
||||||
|
|
||||||
idx = cf2_stack_popInt( opStack );
|
idx = (CF2_UInt)cf2_stack_popInt( opStack );
|
||||||
|
|
||||||
if ( idx >= 0 && idx < CF2_STORAGE_SIZE )
|
if ( idx < CF2_STORAGE_SIZE )
|
||||||
cf2_stack_pushFixed( opStack, storage[idx] );
|
cf2_stack_pushFixed( opStack, storage[idx] );
|
||||||
}
|
}
|
||||||
continue; /* do not clear the stack */
|
continue; /* do not clear the stack */
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
|
|
||||||
/* ensure proper sign extension */
|
/* ensure proper sign extension */
|
||||||
#define Fix2Int( f ) ( (FT_Int)(FT_Short)( (f) >> 16 ) )
|
#define Fix2Int( f ) ( (FT_Int)(FT_Short)( (f) >> 16 ) )
|
||||||
|
#define Fix2UInt( f ) ( (FT_UInt)(FT_Short)( (f) >> 16 ) )
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
*
|
*
|
||||||
|
@ -1025,16 +1026,16 @@
|
||||||
/* <val> <idx> 2 24 callothersubr */
|
/* <val> <idx> 2 24 callothersubr */
|
||||||
/* ==> set BuildCharArray[cvi( <idx> )] = <val> */
|
/* ==> set BuildCharArray[cvi( <idx> )] = <val> */
|
||||||
{
|
{
|
||||||
FT_Int idx;
|
FT_UInt idx;
|
||||||
PS_Blend blend = decoder->blend;
|
PS_Blend blend = decoder->blend;
|
||||||
|
|
||||||
|
|
||||||
if ( arg_cnt != 2 || !blend )
|
if ( arg_cnt != 2 || !blend )
|
||||||
goto Unexpected_OtherSubr;
|
goto Unexpected_OtherSubr;
|
||||||
|
|
||||||
idx = Fix2Int( top[1] );
|
idx = Fix2UInt( top[1] );
|
||||||
|
|
||||||
if ( idx < 0 || (FT_UInt) idx >= decoder->len_buildchar )
|
if ( idx >= decoder->len_buildchar )
|
||||||
goto Unexpected_OtherSubr;
|
goto Unexpected_OtherSubr;
|
||||||
|
|
||||||
decoder->buildchar[idx] = top[0];
|
decoder->buildchar[idx] = top[0];
|
||||||
|
@ -1046,16 +1047,16 @@
|
||||||
/* ==> push BuildCharArray[cvi( idx )] */
|
/* ==> push BuildCharArray[cvi( idx )] */
|
||||||
/* onto T1 stack */
|
/* onto T1 stack */
|
||||||
{
|
{
|
||||||
FT_Int idx;
|
FT_UInt idx;
|
||||||
PS_Blend blend = decoder->blend;
|
PS_Blend blend = decoder->blend;
|
||||||
|
|
||||||
|
|
||||||
if ( arg_cnt != 1 || !blend )
|
if ( arg_cnt != 1 || !blend )
|
||||||
goto Unexpected_OtherSubr;
|
goto Unexpected_OtherSubr;
|
||||||
|
|
||||||
idx = Fix2Int( top[0] );
|
idx = Fix2UInt( top[0] );
|
||||||
|
|
||||||
if ( idx < 0 || (FT_UInt) idx >= decoder->len_buildchar )
|
if ( idx >= decoder->len_buildchar )
|
||||||
goto Unexpected_OtherSubr;
|
goto Unexpected_OtherSubr;
|
||||||
|
|
||||||
top[0] = decoder->buildchar[idx];
|
top[0] = decoder->buildchar[idx];
|
||||||
|
|
|
@ -1356,7 +1356,7 @@
|
||||||
|
|
||||||
if ( cur < limit && ft_isdigit( *cur ) )
|
if ( cur < limit && ft_isdigit( *cur ) )
|
||||||
{
|
{
|
||||||
FT_Long s = T1_ToInt( parser );
|
FT_ULong s = (FT_ULong)T1_ToInt( parser );
|
||||||
|
|
||||||
|
|
||||||
T1_Skip_PS_Token( parser ); /* `RD' or `-|' or something else */
|
T1_Skip_PS_Token( parser ); /* `RD' or `-|' or something else */
|
||||||
|
@ -1365,10 +1365,10 @@
|
||||||
/* `RD' or `-|' token */
|
/* `RD' or `-|' token */
|
||||||
*base = parser->root.cursor + 1;
|
*base = parser->root.cursor + 1;
|
||||||
|
|
||||||
if ( s >= 0 && s < limit - *base )
|
if ( s < (FT_ULong)( limit - *base ) )
|
||||||
{
|
{
|
||||||
parser->root.cursor += s + 1;
|
parser->root.cursor += s + 1;
|
||||||
*size = (FT_ULong)s;
|
*size = s;
|
||||||
return !parser->root.error;
|
return !parser->root.error;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue