diff --git a/src/hb-ot-layout-gsubgpos.hh b/src/hb-ot-layout-gsubgpos.hh index 607307633..ccad1a4c5 100644 --- a/src/hb-ot-layout-gsubgpos.hh +++ b/src/hb-ot-layout-gsubgpos.hh @@ -3104,7 +3104,8 @@ struct GSUBGPOS void closure_features (const hb_map_t *lookup_indexes, /* IN */ hb_set_t *feature_indexes /* OUT */) const { - for (unsigned i = 0; i < get_feature_count (); i++) + unsigned int feature_count = hb_min (get_feature_count (), (unsigned) HB_MAX_FEATURE_INDICES); + for (unsigned i = 0; i < feature_count; i++) { if (get_feature (i).intersects_lookup_indexes (lookup_indexes)) feature_indexes->add (i);