diff --git a/src/hb-ot-layout-gsub-table.hh b/src/hb-ot-layout-gsub-table.hh index 612720e64..fdddca545 100644 --- a/src/hb-ot-layout-gsub-table.hh +++ b/src/hb-ot-layout-gsub-table.hh @@ -1205,7 +1205,9 @@ struct ReverseChainSingleSubstFormat1 const OffsetArrayOf &lookahead = StructAfter> (backtrack); const ArrayOf &substitute = StructAfter> (lookahead); - unsigned int start_index = 0, end_index = 0; + if (unlikely (index >= substitute.len)) return_trace (false); + + unsigned int start_index = 0, end_index = 0; if (match_backtrack (c, backtrack.len, (HBUINT16 *) backtrack.arrayZ, match_coverage, this,