]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix a crash on some versions of GTK
authorPo Lu <luangruo@yahoo.com>
Fri, 18 Feb 2022 10:01:58 +0000 (18:01 +0800)
committerPo Lu <luangruo@yahoo.com>
Fri, 18 Feb 2022 10:04:02 +0000 (18:04 +0800)
* src/emacsgtkfixed.c (XSetWMNormalHints): Fix potential
arithmetic fault.

src/emacsgtkfixed.c

index cd5d1d14353363d0ad1207da7343078905890460..f2c9fa7b7dbf7c55e84799efa1909d3d713e41ae 100644 (file)
@@ -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));
        }
     }