From 1f755a74b7a0268aad6a55764f4ceba3ba4063ff Mon Sep 17 00:00:00 2001 From: Po Lu <luangruo@yahoo.com> Date: Fri, 18 Feb 2022 18:01:58 +0800 Subject: [PATCH] Fix a crash on some versions of GTK * src/emacsgtkfixed.c (XSetWMNormalHints): Fix potential arithmetic fault. --- src/emacsgtkfixed.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/emacsgtkfixed.c b/src/emacsgtkfixed.c index cd5d1d14353..f2c9fa7b7db 100644 --- a/src/emacsgtkfixed.c +++ b/src/emacsgtkfixed.c @@ -183,9 +183,12 @@ XSetWMSizeHints (Display *d, if (hints->flags & PResizeInc) { - if (data[5] % hints->width_inc) + /* Some versions of GTK set PResizeInc even if the + increments are at their initial values. */ + + if (hints->width_inc && data[5] % hints->width_inc) data[5] += (hints->width_inc - (data[5] % hints->width_inc)); - if (data[6] % hints->height_inc) + if (hints->height_inc && data[6] % hints->height_inc) data[6] += (hints->height_inc - (data[6] % hints->height_inc)); } } -- 2.39.5