fepitre / rpms / gtk3

Forked from rpms/gtk3 4 years ago
Clone

Blame SOURCES/0001-x11-Avoid-a-division-by-zero.patch

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