[gtk] x11: Avoid a division by zero
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk] x11: Avoid a division by zero
- Date: Thu, 8 Mar 2018 15:40:54 +0000 (UTC)
commit 01fda3b85ee383637fb9d4befb1bfb7e5cae93b1
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 2d973d425b..2ca0ac7886 100644
--- a/gdk/x11/gdkscreen-x11.c
+++ b/gdk/x11/gdkscreen-x11.c
@@ -548,7 +548,8 @@ init_randr13 (GdkX11Screen *x11_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]