freetype-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[freetype2] master 7915fd5: Doh. Don't use CPAL or COLR data if tables a


From: Werner LEMBERG
Subject: [freetype2] master 7915fd5: Doh. Don't use CPAL or COLR data if tables are missing.
Date: Tue, 19 Jun 2018 01:15:44 -0400 (EDT)

branch: master
commit 7915fd51f123d0adbe6a0b9ad19eb941e1733c87
Author: Werner Lemberg <address@hidden>
Commit: Werner Lemberg <address@hidden>

    Doh.  Don't use CPAL or COLR data if tables are missing.
    
    Reported by Alexei.
    
    * src/sfnt/ttcolr.c (tt_face_get_colr_layer): Return immediately if
    `colr' is NULL.
    
    * src/sfnt/ttcpal.c (tt_face_palette_set): Return immediately, if
    `cpal' is NULL.
---
 ChangeLog         | 12 ++++++++++++
 src/sfnt/ttcolr.c |  3 +++
 src/sfnt/ttcpal.c |  2 +-
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index ce05ec5..af02921 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2018-06-19  Werner Lemberg  <address@hidden>
+
+       Doh.  Don't use CPAL or COLR data if tables are missing.
+
+       Reported by Alexei.
+
+       * src/sfnt/ttcolr.c (tt_face_get_colr_layer): Return immediately if
+       `colr' is NULL.
+
+       * src/sfnt/ttcpal.c (tt_face_palette_set): Return immediately, if
+       `cpal' is NULL.
+
 2018-06-17  Alexei Podtelezhnikov  <address@hidden>
 
        [base] Introduce `FT_New_Glyph'.
diff --git a/src/sfnt/ttcolr.c b/src/sfnt/ttcolr.c
index 4fc4300..b12ebe2 100644
--- a/src/sfnt/ttcolr.c
+++ b/src/sfnt/ttcolr.c
@@ -220,6 +220,9 @@
     FT_UInt          glyph_index;
 
 
+    if ( !colr )
+      return 0;
+
     if ( !iterator->p )
     {
       FT_ULong  offset;
diff --git a/src/sfnt/ttcpal.c b/src/sfnt/ttcpal.c
index 6c6b06d..fc78c67 100644
--- a/src/sfnt/ttcpal.c
+++ b/src/sfnt/ttcpal.c
@@ -258,7 +258,7 @@
     FT_ULong  record_offset;
 
 
-    if ( palette_index >= face->palette_data.num_palettes )
+    if ( !cpal || palette_index >= face->palette_data.num_palettes )
       return FT_THROW( Invalid_Argument );
 
     offset        = cpal->color_indices + 2 * palette_index;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]