[truetype] Fix commit from 2014-11-24. Problem reported by Hin-Tak Leung <htl10@users.sourceforge.net>. * src/truetype/ttpload.c (tt_face_load_hdmx): Fix file checking logic.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
diff --git a/ChangeLog b/ChangeLog
index 54bc4e1..da074a7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2016-10-27 Werner Lemberg <wl@gnu.org>
+
+ [truetype] Fix commit from 2014-11-24.
+
+ Problem reported by Hin-Tak Leung <htl10@users.sourceforge.net>.
+
+ * src/truetype/ttpload.c (tt_face_load_hdmx): Fix file checking
+ logic.
+
2016-10-26 Werner Lemberg <wl@gnu.org>
Add `FT_Get_{MM,Var}_Blend_Coordinates' functions.
diff --git a/src/truetype/ttpload.c b/src/truetype/ttpload.c
index c84c18e..cd1d27c 100644
--- a/src/truetype/ttpload.c
+++ b/src/truetype/ttpload.c
@@ -563,10 +563,11 @@
record_size &= 0xFFFFU;
/* The limit for `num_records' is a heuristic value. */
- if ( version != 0 ||
- num_records > 255 ||
- record_size > 0x10001L ||
- record_size < 4 )
+ if ( version != 0 ||
+ num_records > 255 ||
+ ( num_records > 0 &&
+ ( record_size > 0x10001L ||
+ record_size < 4 ) ) )
{
error = FT_THROW( Invalid_File_Format );
goto Fail;