[sfnt] Don't add instances to non-variation fonts. * src/sfnt/sfobjs.c (sfnt_init_face): Fix it.
diff --git a/ChangeLog b/ChangeLog
index 04a1932..74ce795 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2017-03-20 Werner Lemberg <wl@gnu.org>
+ [sfnt] Don't add instances to non-variation fonts.
+
+ * src/sfnt/sfobjs.c (sfnt_init_face): Fix it.
+
+2017-03-20 Werner Lemberg <wl@gnu.org>
+
* src/cff/cffgload.c (cff_builder_init): Add safety guard (#50578).
2017-03-18 Werner Lemberg <wl@gnu.org>
diff --git a/src/sfnt/sfobjs.c b/src/sfnt/sfobjs.c
index 0418d83..d3de9fc 100644
--- a/src/sfnt/sfobjs.c
+++ b/src/sfnt/sfobjs.c
@@ -1012,8 +1012,9 @@
* later on. Here, we have to adjust `num_instances' accordingly.
*/
- if ( !( FT_ALLOC( default_values, num_axes * 2 ) ||
- FT_ALLOC( instance_values, num_axes * 2 ) ) )
+ if ( ( face->variation_support & TT_FACE_FLAG_VAR_FVAR ) &&
+ !( FT_ALLOC( default_values, num_axes * 2 ) ||
+ FT_ALLOC( instance_values, num_axes * 2 ) ) )
{
/* the current stream position is 16 bytes after the table start */
FT_ULong array_start = FT_STREAM_POS() - 16 + offset;