Fix alternate, again

This commit is contained in:
Behdad Esfahbod 2010-05-20 17:47:28 +01:00
parent fdca3d5160
commit 1cdbfd944e
1 changed files with 3 additions and 3 deletions

View File

@ -287,12 +287,12 @@ struct AlternateSubstFormat1
return false; return false;
unsigned int shift = _hb_ctz (lookup_mask); unsigned int shift = _hb_ctz (lookup_mask);
unsigned int alt_index = ((lookup_mask & glyph_mask) >> shift) - 1; unsigned int alt_index = ((lookup_mask & glyph_mask) >> shift);
if (unlikely (alt_index >= alt_set.len)) if (unlikely (alt_index > alt_set.len || alt_index == 0))
return false; return false;
glyph_id = alt_set[alt_index]; glyph_id = alt_set[alt_index - 1];
c->buffer->replace_glyph (glyph_id); c->buffer->replace_glyph (glyph_id);