[cff] Catch `blend' op in non-variant fonts. Reported as https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=334 * src/cff/cf2intrp.c (cf2_interpT2CharString) <cf2_cmdBLEND>: Don't allow `blend' op for non-variant fonts.
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 38 39
diff --git a/ChangeLog b/ChangeLog
index 627b938..1785457 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
2016-12-28 Werner Lemberg <wl@gnu.org>
+ [cff] Catch `blend' op in non-variant fonts.
+
+ Reported as
+
+ https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=334
+
+ * src/cff/cf2intrp.c (cf2_interpT2CharString) <cf2_cmdBLEND>: Don't
+ allow `blend' op for non-variant fonts.
+
+2016-12-28 Werner Lemberg <wl@gnu.org>
+
[cff] Better check of number of blends.
* src/cff/cf2intrp.c (cf2_interpT2CharString) <cf2_cmdBLEND>,
diff --git a/src/cff/cf2intrp.c b/src/cff/cf2intrp.c
index ef52999..e4824b0 100644
--- a/src/cff/cf2intrp.c
+++ b/src/cff/cf2intrp.c
@@ -678,6 +678,13 @@
if ( !font->isCFF2 )
break; /* clear stack & ignore */
+ /* do we have a `blend' op in a non-variant font? */
+ if ( !font->blend.font )
+ {
+ lastError = FT_THROW( Invalid_Glyph_Format );
+ goto exit;
+ }
+
/* check cached blend vector */
if ( cff_blend_check_vector( &font->blend,
font->vsindex,