From bcce9d4f55bbf313c68a290368dc91a7391ba6a5 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 12 Aug 2026 17:18:11 -0600 Subject: [PATCH] [GPOS] Saturate resolved cursive offsets A mark can resolve its cross-stream position through a cursive attachment chain. Saturate that accumulation so an overlong chain cannot overflow hb_position_t while applying GPOS. This is part of the position-overflow fix for issue #6151. Testing: meson test -C build --print-errorlogs Assisted-by: Codex --- src/OT/Layout/GPOS/MarkArray.hh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/OT/Layout/GPOS/MarkArray.hh b/src/OT/Layout/GPOS/MarkArray.hh index 7d8f59b66..039daf6c2 100644 --- a/src/OT/Layout/GPOS/MarkArray.hh +++ b/src/OT/Layout/GPOS/MarkArray.hh @@ -25,7 +25,8 @@ resolve_cross_offset (const hb_glyph_position_t *pos, if (unlikely (parent >= len)) break; glyph_pos = parent; - offset += horizontal ? pos[glyph_pos].y_offset : pos[glyph_pos].x_offset; + offset = hb_saturate_add (offset, + horizontal ? pos[glyph_pos].y_offset : pos[glyph_pos].x_offset); } return offset; }