diff --git a/src/hb-ot-glyf-table.hh b/src/hb-ot-glyf-table.hh index 866bb7e04..31dc46cee 100644 --- a/src/hb-ot-glyf-table.hh +++ b/src/hb-ot-glyf-table.hh @@ -714,8 +714,11 @@ struct glyf void set_overlaps_flag () { - const_cast (StructAfter (header)) - .set_overlaps_flag (); + CompositeGlyphChain& glyph_chain = const_cast ( + StructAfter (header)); + if (!bytes.check_range(&glyph_chain, CompositeGlyphChain::min_size)) + return; + glyph_chain.set_overlaps_flag (); } };