Fix alternate off-by-one
authorBehdad Esfahbod <behdad@behdad.org>
Thu, 20 May 2010 16:46:20 +0000 (17:46 +0100)
committerBehdad Esfahbod <behdad@behdad.org>
Thu, 20 May 2010 16:46:20 +0000 (17:46 +0100)
src/hb-ot-layout-gsub-private.hh

index fae99d584891f85c9f76fb6782f787e34ba733bb..4c1b168a2e5b2eadcdf1ee49d91206d2e68a96d4 100644 (file)
@@ -287,7 +287,7 @@ struct AlternateSubstFormat1
       return false;
 
     unsigned int shift = _hb_ctz (lookup_mask);
-    unsigned int alt_index = (lookup_mask & glyph_mask) >> shift;
+    unsigned int alt_index = ((lookup_mask & glyph_mask) >> shift) - 1;
 
     if (unlikely (alt_index >= alt_set.len))
       return false;