From 432758a7ac3c1a857e67069f157efbf4ebf5521b Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Sat, 3 Mar 2018 01:05:59 +0330 Subject: [PATCH] [COLR] Revert previous sanitization on the table That sanitization wasn't right, firstLayerIndex is an index from beginning of the Layer Records not the table itself. --- src/hb-ot-colr-table.hh | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/src/hb-ot-colr-table.hh b/src/hb-ot-colr-table.hh index 08a39a99a..dae843eca 100644 --- a/src/hb-ot-colr-table.hh +++ b/src/hb-ot-colr-table.hh @@ -53,17 +53,14 @@ struct LayerRecord struct BaseGlyphRecord { - inline bool sanitize (hb_sanitize_context_t *c, const void *base) const + inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); - return_trace (c->check_struct (this) && - firstLayerIndex.sanitize (c, base) && - c->check_array ((const void*) &firstLayerIndex, sizeof (LayerRecord), numLayers)); + return_trace (c->check_struct (this)); } GlyphID gID; /* Glyph ID of reference glyph */ - OffsetTo - firstLayerIndex; /* Index to the layer record */ + HBUINT16 firstLayerIndex; /* Index to the layer record */ HBUINT16 numLayers; /* Number of color layers associated with this glyph */ public: DEFINE_SIZE_STATIC (6); @@ -76,17 +73,9 @@ struct COLR inline bool sanitize (hb_sanitize_context_t *c) const { TRACE_SANITIZE (this); - if (!(c->check_struct (this) && - c->check_array ((const void*) &baseGlyphRecords, sizeof (BaseGlyphRecord), numBaseGlyphRecords) && - c->check_array ((const void*) &layerRecordsOffset, sizeof (LayerRecord), numLayerRecords))) - return_trace (false); - - const BaseGlyphRecord *base_glyph_records = &baseGlyphRecords (this); - for (unsigned int i = 0; i < numBaseGlyphRecords; ++i) - if (!(base_glyph_records[i].sanitize (c, this))) - return_trace (false); - - return_trace (true); + return_trace (c->check_struct (this) && + c->check_array ((const void*) &layerRecordsOffset, sizeof (LayerRecord), numLayerRecords) && + c->check_array ((const void*) &baseGlyphRecords, sizeof (BaseGlyphRecord), numBaseGlyphRecords)); } protected: