From 075d671f1093d2e3c58f7f45568696030f1b3efd Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 18 Jul 2012 15:41:53 -0400 Subject: [PATCH] [Indic] Fix out-of-bounds array access --- src/hb-ot-shape-complex-indic.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/hb-ot-shape-complex-indic.cc b/src/hb-ot-shape-complex-indic.cc index 394e3f46d..1c80ea49c 100644 --- a/src/hb-ot-shape-complex-indic.cc +++ b/src/hb-ot-shape-complex-indic.cc @@ -475,7 +475,8 @@ initial_reordering_consonant_syllable (const hb_ot_map_t *map, hb_buffer_t *buff for (unsigned int i = start; i < base; i++) info[i].indic_position() = POS_PRE_C; - info[base].indic_position() = POS_BASE_C; + if (base < end) + info[base].indic_position() = POS_BASE_C; /* Mark final consonants. A final consonant is one appearing after a matra, * like in Khmer. */ @@ -577,7 +578,8 @@ initial_reordering_consonant_syllable (const hb_ot_map_t *map, hb_buffer_t *buff info[i].mask |= mask; /* Base */ mask = basic_mask_array[AKHN] | basic_mask_array[CJCT]; - info[base].mask |= mask; + if (base < end) + info[base].mask |= mask; /* Post-base */ mask = basic_mask_array[BLWF] | basic_mask_array[ABVF] | basic_mask_array[PSTF] | basic_mask_array[CJCT]; for (unsigned int i = base + 1; i < end; i++)