From 41ef75f64afc36a8d7d6ab8382dd2093ad86fc49 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 17 Jun 2020 16:29:09 -0700 Subject: [PATCH] [gsub] Don't substitute in ReverseChainSingleSubstFormat1 if missing substitute Fixes https://github.com/harfbuzz/harfbuzz/issues/2467 --- src/hb-ot-layout-gsub-table.hh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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,