More work on supporting fonts passed from GhostScript:
sfnt_dir_check now ignores the tables 'glyx' and 'locx' which are hacked-out versions of 'glyf' and 'loca' in some PostScript Type 42 fonts, and will generally be invalid.
This commit is contained in:
parent
bd8b08513f
commit
320da730d4
|
@ -149,6 +149,10 @@
|
||||||
/* */
|
/* */
|
||||||
/* Voila, here comes robust though tolerant font format checking :-) */
|
/* Voila, here comes robust though tolerant font format checking :-) */
|
||||||
/* */
|
/* */
|
||||||
|
/* When checking directory entries ignore the tables 'glyx' and 'locx' */
|
||||||
|
/* which are hacked-out versions of 'glyf' and 'loca' in some PostScript */
|
||||||
|
/* Type 42 fonts, and will generally be invalid. */
|
||||||
|
/* */
|
||||||
static FT_Error
|
static FT_Error
|
||||||
sfnt_dir_check( FT_Stream stream,
|
sfnt_dir_check( FT_Stream stream,
|
||||||
FT_ULong offset,
|
FT_ULong offset,
|
||||||
|
@ -156,6 +160,8 @@
|
||||||
{
|
{
|
||||||
FT_Error error;
|
FT_Error error;
|
||||||
FT_UInt nn, has_head = 0;
|
FT_UInt nn, has_head = 0;
|
||||||
|
const FT_ULong glyx_tag = FT_MAKE_TAG('g','l','y','x');
|
||||||
|
const FT_ULong locx_tag = FT_MAKE_TAG('l','o','c','x');
|
||||||
|
|
||||||
static const FT_Frame_Field sfnt_dir_entry_fields[] =
|
static const FT_Frame_Field sfnt_dir_entry_fields[] =
|
||||||
{
|
{
|
||||||
|
@ -194,7 +200,8 @@
|
||||||
if ( FT_STREAM_READ_FIELDS( sfnt_dir_entry_fields, &table ) )
|
if ( FT_STREAM_READ_FIELDS( sfnt_dir_entry_fields, &table ) )
|
||||||
goto Bad_Format;
|
goto Bad_Format;
|
||||||
|
|
||||||
if ( offset + table.Offset + table.Length > stream->size )
|
if ( offset + table.Offset + table.Length > stream->size &&
|
||||||
|
table.Tag != glyx_tag && table.Tag != locx_tag )
|
||||||
goto Bad_Format;
|
goto Bad_Format;
|
||||||
|
|
||||||
if ( table.Tag == TTAG_head )
|
if ( table.Tag == TTAG_head )
|
||||||
|
|
Loading…
Reference in New Issue