From cc967849f7653c697c33571a1a6a55e9ffd966ff Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Thu, 8 Mar 2018 15:58:42 +0100 Subject: [PATCH] x11: Avoid a division by zero This is similar to f44baf51d9e8616a but for RandR 1.3 servers like x11rdp and Windows Exceed which don't return a refresh rate. Avoid a crash when that happens. https://bugzilla.gnome.org/show_bug.cgi?id=775546 --- gdk/x11/gdkscreen-x11.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gdk/x11/gdkscreen-x11.c b/gdk/x11/gdkscreen-x11.c index 20fd27531e45..272cecd7aa4b 100644 --- a/gdk/x11/gdkscreen-x11.c +++ b/gdk/x11/gdkscreen-x11.c @@ -658,7 +658,8 @@ init_randr13 (GdkScreen *screen, gboolean *changed) XRRModeInfo *xmode = &resources->modes[j]; if (xmode->id == crtc->mode) { - refresh_rate = (1000 * xmode->dotClock) / (xmode->hTotal *xmode->vTotal); + if (xmode->hTotal != 0 && xmode->vTotal != 0) + refresh_rate = (1000 * xmode->dotClock) / (xmode->hTotal * xmode->vTotal); break; } } -- 2.14.3