[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 <codex@openai.com>
This commit is contained in:
Behdad Esfahbod committed 2026-08-12 17:18:11 -06:00
1 parent a597884edf
commit bcce9d4f55
1 file changed
+2 -1
+2 -1
View File
@@ -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;
}