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.
This commit is contained in:
Behdad Esfahbod 2016-08-08 17:28:54 -07:00
parent 333173103b
commit 09c7a2d6bf

View File

@ -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. */