From 48b6641d97209bb1cc3eb39c2790e631daf570d3 Mon Sep 17 00:00:00 2001 From: Michael Grant Date: Sat, 8 Aug 2026 10:33:54 +0100 Subject: [PATCH] Avoid overflow in image cell size calculation --- image.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/image.c b/image.c index 4d2ce2b98..1c5d67811 100644 --- a/image.c +++ b/image.c @@ -633,8 +633,8 @@ image_size_in_cells(u_int width, u_int height, u_int xpixel, u_int ypixel, xpixel = 8; if (ypixel == 0) ypixel = 16; - *sx = ((uint64_t)width + xpixel - 1) / xpixel; - *sy = ((uint64_t)height + ypixel - 1) / ypixel; + *sx = width / xpixel + (width % xpixel != 0); + *sy = height / ypixel + (height % ypixel != 0); } /* Decode a base64 payload with a size limit. */