shithub: freetype+ttf2subf

Download patch

ref: 0a33b44e6eb31b7c5bfed32cf723a0eee1e4e169
parent: 4873eb1d316f7a6b0df97ccd3b3bd4b563fcd1de
author: Werner Lemberg <[email protected]>
date: Tue Aug 21 06:52:14 EDT 2018

* src/sfnt/ttcpal.c (tt_face_load_cpal): Add missing safety check.

Reported as

  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9981

git/fs: mount .git/fs: mount/attach disallowed
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2018-08-21  Werner Lemberg  <[email protected]>
+
+	* src/sfnt/ttcpal.c (tt_face_load_cpal): Add missing safety check.
+
+	Reported as
+
+	  https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=9981
+
 2018-08-18  Werner Lemberg  <[email protected]>
 
 	[psaux] Avoid slow PS font parsing in case of error.
--- a/src/sfnt/ttcpal.c
+++ b/src/sfnt/ttcpal.c
@@ -121,6 +121,9 @@
     if ( cpal->num_colors * COLOR_SIZE > table_size - colors_offset )
       goto InvalidTable;
 
+    if ( face->palette_data.num_palette_entries > cpal->num_colors )
+      goto InvalidTable;
+
     cpal->color_indices = p;
     cpal->colors        = (FT_Byte*)( table + colors_offset );