[HarfBuzz] harfbuzz: Branch 'master'

Behdad Esfahbod behdad at kemper.freedesktop.org
Tue Apr 17 13:32:23 UTC 2018


 src/hb-ot-color-colr-table.hh |    9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

New commits:
commit 924803166e074c569ecfa7e598686f334777770f
Author: Behdad Esfahbod <behdad at behdad.org>
Date:   Tue Apr 17 15:32:02 2018 +0200

    [colr] Check layer record access

diff --git a/src/hb-ot-color-colr-table.hh b/src/hb-ot-color-colr-table.hh
index 6e280a3d..4d761fca 100644
--- a/src/hb-ot-color-colr-table.hh
+++ b/src/hb-ot-color-colr-table.hh
@@ -110,13 +110,20 @@ struct COLR
     return true;
   }
 
-  inline void get_layer_record (unsigned int record,
+  inline bool get_layer_record (unsigned int record,
 				hb_codepoint_t *glyph_id /* OUT */,
 				unsigned int *palette_index /* OUT */) const
   {
+    if (unlikely (record >= numLayers))
+    {
+      *glyph_id = 0;
+      *palette_index = 0xFFFF;
+      return false;
+    }
     const LayerRecord &layer = (this+layersZ)[record];
     *glyph_id = layer.glyphid;
     *palette_index = layer.colorIdx;
+    return true;
   }
 
   protected:


More information about the HarfBuzz mailing list