shithub: freetype+ttf2subf

Download patch

ref: c07ca2a1b3cb5057b7cb98f5b15c0704374d7a47
parent: 22d1be3f2c40bd85ef825efc3ee524d40d842589
author: Werner Lemberg <[email protected]>
date: Tue Jun 12 07:28:55 EDT 2018

[sfnt] Fix `sizeof' thinko.

* src/sfnt/ttcolr.c (tt_face_load_colr, tt_face_palette_set): Don't
use `sizeof' for computing array limit.

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 2018-06-12  Werner Lemberg  <[email protected]>
 
+	[sfnt] Fix `sizeof' thinko.
+
+	* src/sfnt/ttcolr.c (tt_face_load_colr, tt_face_palette_set): Don't
+	use `sizeof' for computing array limit.
+
+2018-06-12  Werner Lemberg  <[email protected]>
+
 	Finish CPAL/COLR support (4/4).
 
 	* src/sfnt/ttcolr.c (tt_face_find_color): Removed.
--- a/src/sfnt/ttcolr.c
+++ b/src/sfnt/ttcolr.c
@@ -227,7 +227,7 @@
 
         p     = cpal_table + type_offset;
         q     = array;
-        limit = q + face->palette_data.num_palettes * sizeof ( FT_UShort );
+        limit = q + face->palette_data.num_palettes;
 
         while ( q < limit )
           *q++ = FT_NEXT_USHORT( p );
@@ -248,7 +248,7 @@
 
         p     = cpal_table + label_offset;
         q     = array;
-        limit = q + face->palette_data.num_palettes * sizeof ( FT_UShort );
+        limit = q + face->palette_data.num_palettes;
 
         while ( q < limit )
           *q++ = FT_NEXT_USHORT( p );
@@ -269,8 +269,7 @@
 
         p     = cpal_table + entry_label_offset;
         q     = array;
-        limit = q + face->palette_data.num_palette_entries *
-                    sizeof ( FT_UShort );
+        limit = q + face->palette_data.num_palette_entries;
 
         while ( q < limit )
           *q++ = FT_NEXT_USHORT( p );
@@ -459,7 +458,7 @@
     p      = cpal->colors + COLOR_SIZE * FT_PEEK_USHORT( offset );
 
     q     = face->palette;
-    limit = q + face->palette_data.num_palette_entries * sizeof ( FT_Color );
+    limit = q + face->palette_data.num_palette_entries;
 
     while ( q < limit )
     {