From 09c7a2d6bf00dc902343e999f92cac0e8146f949 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 8 Aug 2016 17:28:54 -0700 Subject: [PATCH] Limit bits-per-feature to eight Limits number of alternatives per glyph per feature to 255, so be it. That's better than possibly breaking shaping because of one bad feature value. --- src/hb-ot-map.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/hb-ot-map.cc b/src/hb-ot-map.cc index 35550af..17e3f40 100644 --- a/src/hb-ot-map.cc +++ b/src/hb-ot-map.cc @@ -193,7 +193,8 @@ hb_ot_map_builder_t::compile (hb_ot_map_t &m) /* Uses the global bit */ bits_needed = 0; else - bits_needed = _hb_bit_storage (info->max_value); + /* Limit to 8 bits per feature. */ + bits_needed = MIN(8u, _hb_bit_storage (info->max_value)); if (!info->max_value || next_bit + bits_needed > 8 * sizeof (hb_mask_t)) continue; /* Feature disabled, or not enough bits. */ -- 2.7.4