From 3e4341ad20056744335e993e1d416dfd92a0b50d Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Wed, 12 Aug 2026 18:41:09 -0600 Subject: [PATCH] [gpu] Saturate clip-path extents Clip paths add two full-range glyph-extents fields to find their far edge. Saturate those additions instead of narrowing an out-of-range 64-bit result back to int. Tested with: meson test -C build --print-errorlogs Assisted-by: OpenAI Codex --- src/hb-gpu-paint.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/hb-gpu-paint.cc b/src/hb-gpu-paint.cc index 2c0239b05..a30164bc2 100644 --- a/src/hb-gpu-paint.cc +++ b/src/hb-gpu-paint.cc @@ -176,9 +176,9 @@ hb_gpu_paint_push_clip_path_end (hb_paint_funcs_t *funcs HB_UNUSED, } int x0 = ext.x_bearing; - int x1 = (int) ((int64_t) ext.x_bearing + ext.width); + int x1 = hb_saturate_add (ext.x_bearing, ext.width); int y0 = ext.y_bearing; - int y1 = (int) ((int64_t) ext.y_bearing + ext.height); + int y1 = hb_saturate_add (ext.y_bearing, ext.height); c->clip_stack[c->clip_depth] = { HB_CODEPOINT_INVALID, nullptr,