[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.
pull/855/head
Ebrahim Byagowi 7 years ago committed by GitHub
parent 71b4598ea3
commit 432758a7ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 23
      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<LayerRecord>
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:

Loading…
Cancel
Save