From 31eac7170302ef731858d81082477f225596a42e Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Sat, 29 Nov 2025 16:14:30 -0700 Subject: [PATCH] [kbts] Fix buffer access (#5660) --- src/hb-kbts.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/hb-kbts.cc b/src/hb-kbts.cc index f3d18f536..c7db299e5 100644 --- a/src/hb-kbts.cc +++ b/src/hb-kbts.cc @@ -172,10 +172,10 @@ _hb_kbts_shape (hb_shape_plan_t *shape_plan, } uint32_t glyph_count = 0; - hb_glyph_info_t *info = buffer->info; - hb_glyph_position_t *pos = buffer->pos; kbts_glyph *kb_glyph = nullptr; kbts_glyph_iterator kb_output; + hb_glyph_info_t *info; + hb_glyph_position_t *pos; kbts_shape_config *kb_shape_config = kbts_CreateShapeConfig (kb_font, kb_script, kb_language, nullptr, nullptr); hb_bool_t res = kbts_ShapeDirect (kb_shape_config, kb_glyph_storage, kb_direction, @@ -191,6 +191,9 @@ _hb_kbts_shape (hb_shape_plan_t *shape_plan, buffer->clear_positions (); + info = buffer->info; + pos = buffer->pos; + for (auto it = kb_output; kbts_GlyphIteratorNext (&it, &kb_glyph); info++, pos++) { info->codepoint = kb_glyph->Id;