[gtk/gtk-3-22] x11: Avoid a division by zero
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/gtk-3-22] x11: Avoid a division by zero
- Date: Thu, 8 Mar 2018 15:20:32 +0000 (UTC)
commit cc967849f7653c697c33571a1a6a55e9ffd966ff
Author: Pavel Roskin <plroskin gmail com>
Date: Thu Mar 8 15:58:42 2018 +0100
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 20fd27531e..272cecd7aa 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;
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]