[truetype] Fix loading of composite glyphs.

* src/truetype/ttgload.c (TT_Load_Composite_Glyph): If the
ARGS_ARE_XY_VALUES flag is not set, handle argument values as
unsigned.  I trust `ttx' (which has exactly such code) that it does
the right thing here...

The reason that noone has ever noticed this bug is probably the fact
that point-aligned subglyphs are rare, as are subglyphs with a
number of points in the range [128;255], which is quite large (or
even in the range [32768;65535], which is extremely unlikely).
This commit is contained in:
Werner Lemberg 2015-05-17 22:54:48 +02:00
parent a87fb8ccf3
commit 0a6b6ff7c6
2 changed files with 35 additions and 5 deletions

View File

@ -1,3 +1,17 @@
2015-05-17 Werner Lemberg <wl@gnu.org>
[truetype] Fix loading of composite glyphs.
* src/truetype/ttgload.c (TT_Load_Composite_Glyph): If the
ARGS_ARE_XY_VALUES flag is not set, handle argument values as
unsigned. I trust `ttx' (which has exactly such code) that it does
the right thing here...
The reason that noone has ever noticed this bug is probably the fact
that point-aligned subglyphs are rare, as are subglyphs with a
number of points in the range [128;255], which is quite large (or
even in the range [32768;65535], which is extremely unlikely).
2015-05-12 Chris Liddell <chris.liddell@artifex.com>
[cff] Make the `*curveto' operators more tolerant.

View File

@ -621,6 +621,8 @@
goto Invalid_Composite;
/* read arguments */
if ( subglyph->flags & ARGS_ARE_XY_VALUES )
{
if ( subglyph->flags & ARGS_ARE_WORDS )
{
subglyph->arg1 = FT_NEXT_SHORT( p );
@ -631,6 +633,20 @@
subglyph->arg1 = FT_NEXT_CHAR( p );
subglyph->arg2 = FT_NEXT_CHAR( p );
}
}
else
{
if ( subglyph->flags & ARGS_ARE_WORDS )
{
subglyph->arg1 = (FT_Int)FT_NEXT_USHORT( p );
subglyph->arg2 = (FT_Int)FT_NEXT_USHORT( p );
}
else
{
subglyph->arg1 = (FT_Int)FT_NEXT_BYTE( p );
subglyph->arg2 = (FT_Int)FT_NEXT_BYTE( p );
}
}
/* read transform */
xx = yy = 0x10000L;