shithub: freetype+ttf2subf

Download patch

ref: ba1a6acf288be44d0b816e3f520a9ab520c996d2
parent: 53fea877458e7d47b53e924c3710bbe739651ed2
author: Werner Lemberg <[email protected]>
date: Fri Jan 15 05:09:00 EST 2021

[sfnt] Additional checks for 'colr' table presence.

* sfnt/ttcolr.c (tt_face_get_colr_glyph_paint,
tt_face_get_colorline_stops, tt_face_get_paint): Additional checks
for whether colr table is present.  Prevents crashes when these
methods are called on non-COLR fonts.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2021-01-14  Dominik Röttsches  <[email protected]>
+
+	[sfnt] Additional checks for 'colr' table presence.
+
+	* sfnt/ttcolr.c (tt_face_get_colr_glyph_paint,
+	tt_face_get_colorline_stops, tt_face_get_paint): Additional checks
+	for whether colr table is present.  Prevents crashes when these
+	methods are called on non-COLR fonts.
+
 2021-01-13  Dominik Röttsches  <[email protected]>
 
 	Add config option to test for 'COLR' v1 support in headers.
--- a/src/sfnt/ttcolr.c
+++ b/src/sfnt/ttcolr.c
@@ -665,6 +665,9 @@
     FT_Byte*           p;
 
 
+    if ( !colr )
+      return 0;
+
     if ( colr->version < 1 || !colr->num_base_glyphs_v1 ||
          !colr->base_glyphs_v1 )
       return 0;
@@ -755,6 +758,9 @@
     FT_Byte*  p;
 
 
+    if ( !colr )
+      return 0;
+
     if ( iterator->current_color_stop >= iterator->num_color_stops )
       return 0;
 
@@ -792,6 +798,9 @@
 
     FT_Byte*  p;
 
+
+    if ( !colr )
+      return 0;
 
     if ( opaque_paint.p < (FT_Byte*)colr->table                         ||
          opaque_paint.p >= ( (FT_Byte*)colr->table + colr->table_size ) )