From 48cc5b17cabab9a8d6a13bdf334a42fd23f2fb07 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 12 Aug 2026 18:30:05 -0600 Subject: [PATCH] [BASE] Saturate synthesized math baseline Math baseline synthesis adds a full-range glyph bearing and half its height. Saturate that final coordinate instead of relying on signed position addition. This is part of the complete position-overflow fix for issue #6151. Testing: meson test -C build --print-errorlogs Assisted-by: Codex --- src/hb-ot-layout.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hb-ot-layout.cc b/src/hb-ot-layout.cc index 72d5c49b4..ea40b4939 100644 --- a/src/hb-ot-layout.cc +++ b/src/hb-ot-layout.cc @@ -2389,7 +2389,7 @@ hb_ot_layout_get_baseline_with_fallback (hb_font_t *font, hb_font_get_nominal_glyph (font, '-', &glyph)) && hb_font_get_glyph_extents (font, glyph, &extents)) { - *coord = extents.y_bearing + extents.height / 2; + *coord = hb_saturate_add (extents.y_bearing, extents.height / 2); } else {