[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

@ -1976,22 +1976,24 @@ struct COLR
paint_glyph (hb_font_t *font, hb_codepoint_t glyph, hb_paint_funcs_t *funcs, void *data, unsigned int palette, hb_color_t foreground) const
{
VarStoreInstancer instancer (this+varStore,
this+varIdxMap,
hb_array (font->coords, font->num_coords));
this+varIdxMap,
hb_array (font->coords, font->num_coords));
hb_paint_context_t c (this, funcs, data, font, palette, foreground, instancer);
const Paint *paint = get_base_glyph_paint (glyph);
if (paint)
if (version == 1)
{
// COLRv1 glyph
c.funcs->push_root_transform (c.data, font);
const Paint *paint = get_base_glyph_paint (glyph);
if (paint)
{
// COLRv1 glyph
c.funcs->push_root_transform (c.data, font);
c.recurse (*paint);
c.recurse (*paint);
c.funcs->pop_root_transform (c.data);
c.funcs->pop_root_transform (c.data);
return true;
return true;
}
}
const BaseGlyphRecord *record = get_base_glyph_record (glyph);