[colr] Don't access baseGlyphList unless v1

This was showing up sporadic crashes due to
invalid reads.
This commit is contained in:
Matthias Clasen 2022-12-22 16:23:50 -05:00 committed by Behdad Esfahbod
parent 47dbebff39
commit 5bd3c07b54
1 changed files with 12 additions and 10 deletions

View File

@ -1978,9 +1978,10 @@ struct COLR
VarStoreInstancer instancer (this+varStore, VarStoreInstancer instancer (this+varStore,
this+varIdxMap, this+varIdxMap,
hb_array (font->coords, font->num_coords)); hb_array (font->coords, font->num_coords));
hb_paint_context_t c (this, funcs, data, font, palette, foreground, instancer); hb_paint_context_t c (this, funcs, data, font, palette, foreground, instancer);
if (version == 1)
{
const Paint *paint = get_base_glyph_paint (glyph); const Paint *paint = get_base_glyph_paint (glyph);
if (paint) if (paint)
{ {
@ -1993,6 +1994,7 @@ struct COLR
return true; return true;
} }
}
const BaseGlyphRecord *record = get_base_glyph_record (glyph); const BaseGlyphRecord *record = get_base_glyph_record (glyph);
if (record && ((hb_codepoint_t) record->glyphId == glyph)) if (record && ((hb_codepoint_t) record->glyphId == glyph))