From 5dd69d81b0d2a1e2323dd780a684c041ffb310ed Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Mon, 26 Dec 2022 08:23:55 -0500 Subject: [PATCH] Fix hb_ot_color_has_paint We must no access v1 data without checking that version is 1. A bit of a trap. --- src/hb-ot-color-colr-table.hh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/hb-ot-color-colr-table.hh b/src/hb-ot-color-colr-table.hh index a5ebc8e7e..6af8cad13 100644 --- a/src/hb-ot-color-colr-table.hh +++ b/src/hb-ot-color-colr-table.hh @@ -1701,7 +1701,13 @@ struct COLR static constexpr hb_tag_t tableTag = HB_OT_TAG_COLR; bool has_v0_data () const { return numBaseGlyphs; } - bool has_v1_data () const { return (this+baseGlyphList).len; } + bool has_v1_data () const + { + if (version == 1) + return (this+baseGlyphList).len > 0; + + return false; + } unsigned int get_glyph_layers (hb_codepoint_t glyph, unsigned int start_offset,