summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWerner Lemberg <wl@gnu.org>2016-12-24 09:05:16 +0100
committerWerner Lemberg <wl@gnu.org>2016-12-24 09:05:16 +0100
commitd1db57c284c9139fc520354c79af6a59bebc556b (patch)
tree043e8a03aaf4ce782e7d8af02816e9a2e28584d6
parentfde0b78ccea93f26c618e7e7e1245ac4132c0d7b (diff)
downloadfreetype2-d1db57c284c9139fc520354c79af6a59bebc556b.tar.gz
* src/sfnt/ttsbit.c (tt_face_load_sbit): Allow more version values.
Some fonts seem to have the `version' field in the wrong byte order. Problem reported by 張俊芝 <418092625@qq.com>.
-rw-r--r--ChangeLog8
-rw-r--r--src/sfnt/ttsbit.c6
2 files changed, 13 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index c126f7f7e..775201abc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
2016-12-24 Werner Lemberg <wl@gnu.org>
+ * src/sfnt/ttsbit.c (tt_face_load_sbit): Allow more version values.
+
+ Some fonts seem to have the `version' field in the wrong byte order.
+
+ Problem reported by 張俊芝 <418092625@qq.com>.
+
+2016-12-24 Werner Lemberg <wl@gnu.org>
+
* src/truetype/ttpload.c (tt_face_load_loca): Sanitize table length.
This trivial fix allows us to accept more fonts.
diff --git a/src/sfnt/ttsbit.c b/src/sfnt/ttsbit.c
index bc51304b6..bf6ecca5a 100644
--- a/src/sfnt/ttsbit.c
+++ b/src/sfnt/ttsbit.c
@@ -107,8 +107,12 @@
version = FT_NEXT_LONG( p );
num_strikes = FT_NEXT_ULONG( p );
+ /* there's at least one font (FZShuSong-Z01, version 3) */
+ /* that uses the wrong byte order for the `version' field */
if ( ( (FT_ULong)version & 0xFFFF0000UL ) != 0x00020000UL &&
- ( (FT_ULong)version & 0xFFFF0000UL ) != 0x00030000UL )
+ ( (FT_ULong)version & 0x0000FFFFUL ) != 0x00000200UL &&
+ ( (FT_ULong)version & 0xFFFF0000UL ) != 0x00030000UL &&
+ ( (FT_ULong)version & 0x0000FFFFUL ) != 0x00000300UL )
{
error = FT_THROW( Unknown_File_Format );
goto Exit;