diff --git a/src/hb-ot-layout-common.hh b/src/hb-ot-layout-common.hh index f1288efab..0509da716 100644 --- a/src/hb-ot-layout-common.hh +++ b/src/hb-ot-layout-common.hh @@ -3020,6 +3020,8 @@ struct VarData unsigned ri_count = ri_map.get_population (); regionIndices.len = ri_count; + if (unlikely (hb_unsigned_mul_overflows (get_row_size (), itemCount))) + return_trace (false); if (unlikely (!c->extend (this))) return_trace (false); for (unsigned r = 0; r < ri_count; r++) @@ -3124,6 +3126,8 @@ struct VarData regionIndices.len = new_ri_count; + if (unlikely (hb_unsigned_mul_overflows (get_row_size (), itemCount))) + return_trace (false); if (unlikely (!c->extend (this))) return_trace (false); for (r = 0; r < new_ri_count; r++)