[truetype] Improve handling of stack underflow.
* src/truetype/ttinterp.c (TT_RunIns, Ins_FLIPPT, Ins_DELTAP, Ins_DELTAC): Exit with error only if `pedantic_hinting' is set. Otherwise, try to do something sane.
This commit is contained in:
parent
91a97164ca
commit
96f0456483
|
@ -1,3 +1,11 @@
|
|||
2011-01-31 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
[truetype] Improve handling of stack underflow.
|
||||
|
||||
* src/truetype/ttinterp.c (TT_RunIns, Ins_FLIPPT, Ins_DELTAP,
|
||||
Ins_DELTAC): Exit with error only if `pedantic_hinting' is set.
|
||||
Otherwise, try to do something sane.
|
||||
|
||||
2011-01-30 Werner Lemberg <wl@gnu.org>
|
||||
|
||||
* src/sfnt/ttmtx.c (tt_face_load_hmtx): Fix tracing message.
|
||||
|
|
|
@ -5463,10 +5463,14 @@
|
|||
|
||||
|
||||
if ( CUR.top < CUR.GS.loop )
|
||||
{
|
||||
if ( CUR.pedantic_hinting )
|
||||
{
|
||||
CUR.error = TT_Err_Too_Few_Arguments;
|
||||
return;
|
||||
}
|
||||
CUR.GS.loop = CUR.top;
|
||||
}
|
||||
|
||||
while ( CUR.GS.loop > 0 )
|
||||
{
|
||||
|
@ -6859,8 +6863,9 @@
|
|||
|
||||
if ( CUR.args < n )
|
||||
{
|
||||
if ( CUR.pedantic_hinting )
|
||||
CUR.error = TT_Err_Too_Few_Arguments;
|
||||
return;
|
||||
n = CUR.args;
|
||||
}
|
||||
|
||||
CUR.args -= n;
|
||||
|
@ -6876,8 +6881,10 @@
|
|||
{
|
||||
if ( CUR.args < 2 )
|
||||
{
|
||||
if ( CUR.pedantic_hinting )
|
||||
CUR.error = TT_Err_Too_Few_Arguments;
|
||||
return;
|
||||
CUR.args = 0;
|
||||
goto Fail;
|
||||
}
|
||||
|
||||
CUR.args -= 2;
|
||||
|
@ -6926,6 +6933,7 @@
|
|||
CUR.error = TT_Err_Invalid_Reference;
|
||||
}
|
||||
|
||||
Fail:
|
||||
CUR.new_top = CUR.args;
|
||||
}
|
||||
|
||||
|
@ -6953,8 +6961,9 @@
|
|||
|
||||
if ( CUR.args < n )
|
||||
{
|
||||
if ( CUR.pedantic_hinting )
|
||||
CUR.error = TT_Err_Too_Few_Arguments;
|
||||
return;
|
||||
n = CUR.args;
|
||||
}
|
||||
|
||||
CUR.args -= n;
|
||||
|
@ -6969,8 +6978,10 @@
|
|||
{
|
||||
if ( CUR.args < 2 )
|
||||
{
|
||||
if ( CUR.pedantic_hinting )
|
||||
CUR.error = TT_Err_Too_Few_Arguments;
|
||||
return;
|
||||
CUR.args = 0;
|
||||
goto Fail;
|
||||
}
|
||||
|
||||
CUR.args -= 2;
|
||||
|
@ -7018,6 +7029,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
Fail:
|
||||
CUR.new_top = CUR.args;
|
||||
}
|
||||
|
||||
|
@ -7478,11 +7490,22 @@
|
|||
/* `args' is the top of the stack once arguments have been popped. */
|
||||
/* One can also interpret it as the index of the last argument. */
|
||||
if ( CUR.args < 0 )
|
||||
{
|
||||
FT_UShort i;
|
||||
|
||||
|
||||
if ( CUR.pedantic_hinting )
|
||||
{
|
||||
CUR.error = TT_Err_Too_Few_Arguments;
|
||||
goto LErrorLabel_;
|
||||
}
|
||||
|
||||
/* push zeroes onto the stack */
|
||||
for ( i = 0; i < Pop_Push_Count[CUR.opcode] >> 4; i++ )
|
||||
CUR.stack[i] = 0;
|
||||
CUR.args = 0;
|
||||
}
|
||||
|
||||
CUR.new_top = CUR.args + ( Pop_Push_Count[CUR.opcode] & 15 );
|
||||
|
||||
/* `new_top' is the new top of the stack, after the instruction's */
|
||||
|
|
Loading…
Reference in New Issue