From db6c4156afed774585d36b68a513565c9c52952a Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Mon, 1 Jun 2020 12:23:36 +0300 Subject: [PATCH] dwrite: Fix offsets when stepping through chain rule fields. Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/dwrite/opentype.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dlls/dwrite/opentype.c b/dlls/dwrite/opentype.c index f1b9fb4e474..29f2a95a8c1 100644 --- a/dlls/dwrite/opentype.c +++ b/dlls/dwrite/opentype.c @@ -5180,10 +5180,12 @@ static BOOL opentype_layout_apply_chain_rule_set(const struct match_context *mc, backtrack = table_read_ensure(table, rule_offset, backtrack_count * sizeof(*backtrack)); rule_offset += backtrack_count * sizeof(*backtrack); - input_count = table_read_be_word(table, rule_offset); + if (!(input_count = table_read_be_word(table, rule_offset))) + continue; + rule_offset += 2; - input = table_read_ensure(table, rule_offset, input_count * sizeof(*input)); - rule_offset += input_count * sizeof(*input); + input = table_read_ensure(table, rule_offset, (input_count - 1) * sizeof(*input)); + rule_offset += (input_count - 1) * sizeof(*input); lookahead_count = table_read_be_word(table, rule_offset); rule_offset += 2;