From 274207eb9a0e3bb20edf30e9a62e25120d5d15e5 Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 18 Jul 2013 12:38:57 +0200 Subject: [PATCH] [sfnt] Ignore invalid magic number in `head' or `bhed'. Other font engines seem to ignore it also. Problem reported by Hin-Tak Leung . * src/sfnt/ttload.c (check_table_dir): Don't abort but warn only if we have an invalid magic number. --- ChangeLog | 10 ++++++++++ src/sfnt/ttload.c | 9 +++------ 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/ChangeLog b/ChangeLog index bf47171db..dc27c1a5d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2013-07-18 Werner Lemberg + + [sfnt] Ignore invalid magic number in `head' or `bhed'. + + Other font engines seem to ignore it also. Problem reported by + Hin-Tak Leung . + + * src/sfnt/ttload.c (check_table_dir): Don't abort but warn only if + we have an invalid magic number. + 2013-07-16 Werner Lemberg [smooth] Fix segfault caused by previous commit. diff --git a/src/sfnt/ttload.c b/src/sfnt/ttload.c index fbe70f797..89a8ae04c 100644 --- a/src/sfnt/ttload.c +++ b/src/sfnt/ttload.c @@ -236,7 +236,8 @@ */ if ( table.Length < 0x36 ) { - FT_TRACE2(( "check_table_dir: `head' table too small\n" )); + FT_TRACE2(( "check_table_dir:" + " `head' or `bhed' table too small\n" )); error = FT_THROW( Table_Missing ); goto Exit; } @@ -246,12 +247,8 @@ goto Exit; if ( magic != 0x5F0F3CF5UL ) - { FT_TRACE2(( "check_table_dir:" - " no magic number found in `head' table\n")); - error = FT_THROW( Table_Missing ); - goto Exit; - } + " invalid magic number in `head' or `bhed' table\n")); if ( FT_STREAM_SEEK( offset + ( nn + 1 ) * 16 ) ) goto Exit;