[cff] Make the `*curveto' operators more tolerant.
* src/cff/cf2intrp.c (cf2_interpT2CharString): The opcodes `vvcurveto', `hhcurveto', `vhcurveto', and `hvcurveto' all iterate, pulling values off the stack until the stack is exhausted. Implicitly the stack must be a multiple (or for subtly different behaviour) a multiple plus a specific number of extra values deep. If that's not the case, enforce it (as the old code did).
This commit is contained in:
parent
d65bf72c3e
commit
a87fb8ccf3
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
||||||
|
2015-05-12 Chris Liddell <chris.liddell@artifex.com>
|
||||||
|
|
||||||
|
[cff] Make the `*curveto' operators more tolerant.
|
||||||
|
|
||||||
|
* src/cff/cf2intrp.c (cf2_interpT2CharString): The opcodes
|
||||||
|
`vvcurveto', `hhcurveto', `vhcurveto', and `hvcurveto' all iterate,
|
||||||
|
pulling values off the stack until the stack is exhausted.
|
||||||
|
Implicitly the stack must be a multiple (or for subtly different
|
||||||
|
behaviour) a multiple plus a specific number of extra values deep.
|
||||||
|
If that's not the case, enforce it (as the old code did).
|
||||||
|
|
||||||
2015-05-12 Chris Liddell <chris.liddell@artifex.com>
|
2015-05-12 Chris Liddell <chris.liddell@artifex.com>
|
||||||
|
|
||||||
[cff] fix incremental interface with new cff code.
|
[cff] fix incremental interface with new cff code.
|
||||||
|
|
|
@ -1298,10 +1298,16 @@
|
||||||
|
|
||||||
case cf2_cmdVVCURVETO:
|
case cf2_cmdVVCURVETO:
|
||||||
{
|
{
|
||||||
CF2_UInt count = cf2_stack_count( opStack );
|
CF2_UInt count, count1 = cf2_stack_count( opStack );
|
||||||
CF2_UInt index = 0;
|
CF2_UInt index = 0;
|
||||||
|
|
||||||
|
|
||||||
|
/* if `cf2_stack_count' isn't of the form 4n or 4n+1, */
|
||||||
|
/* we enforce it by clearing the second bit */
|
||||||
|
/* (and sorting the stack indexing to suit) */
|
||||||
|
count = count1 & ~2;
|
||||||
|
index += count1 - count;
|
||||||
|
|
||||||
FT_TRACE4(( " vvcurveto\n" ));
|
FT_TRACE4(( " vvcurveto\n" ));
|
||||||
|
|
||||||
while ( index < count )
|
while ( index < count )
|
||||||
|
@ -1337,10 +1343,16 @@
|
||||||
|
|
||||||
case cf2_cmdHHCURVETO:
|
case cf2_cmdHHCURVETO:
|
||||||
{
|
{
|
||||||
CF2_UInt count = cf2_stack_count( opStack );
|
CF2_UInt count, count1 = cf2_stack_count( opStack );
|
||||||
CF2_UInt index = 0;
|
CF2_UInt index = 0;
|
||||||
|
|
||||||
|
|
||||||
|
/* if `cf2_stack_count' isn't of the form 4n or 4n+1, */
|
||||||
|
/* we enforce it by clearing the second bit */
|
||||||
|
/* (and sorting the stack indexing to suit) */
|
||||||
|
count = count1 & ~2;
|
||||||
|
index += count1 - count;
|
||||||
|
|
||||||
FT_TRACE4(( " hhcurveto\n" ));
|
FT_TRACE4(( " hhcurveto\n" ));
|
||||||
|
|
||||||
while ( index < count )
|
while ( index < count )
|
||||||
|
@ -1377,12 +1389,19 @@
|
||||||
case cf2_cmdVHCURVETO:
|
case cf2_cmdVHCURVETO:
|
||||||
case cf2_cmdHVCURVETO:
|
case cf2_cmdHVCURVETO:
|
||||||
{
|
{
|
||||||
CF2_UInt count = cf2_stack_count( opStack );
|
CF2_UInt count, count1 = cf2_stack_count( opStack );
|
||||||
CF2_UInt index = 0;
|
CF2_UInt index = 0;
|
||||||
|
|
||||||
FT_Bool alternate = op1 == cf2_cmdHVCURVETO;
|
FT_Bool alternate = op1 == cf2_cmdHVCURVETO;
|
||||||
|
|
||||||
|
|
||||||
|
/* if `cf2_stack_count' isn't of the form 8n, 8n+1, */
|
||||||
|
/* 8n+4, or 8n+5, we enforce it by clearing the */
|
||||||
|
/* second bit */
|
||||||
|
/* (and sorting the stack indexing to suit) */
|
||||||
|
count = count1 & ~2;
|
||||||
|
index += count1 - count;
|
||||||
|
|
||||||
FT_TRACE4(( alternate ? " hvcurveto\n" : " vhcurveto\n" ));
|
FT_TRACE4(( alternate ? " hvcurveto\n" : " vhcurveto\n" ));
|
||||||
|
|
||||||
while ( index < count )
|
while ( index < count )
|
||||||
|
|
Loading…
Reference in New Issue