Fix sigfpe. Resolves: rhbz#1941627

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
Marc-André Lureau 2021-06-28 20:38:14 +04:00
parent 8a4cd14596
commit bf94d3735b
2 changed files with 44 additions and 1 deletions

View File

@ -0,0 +1,38 @@
From edba707b32d47977e14f576854f61a0c1a569eab Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= <marcandre.lureau@redhat.com>
Date: Mon, 28 Jun 2021 12:12:21 +0400
Subject: [PATCH spice-gtk] Fix potential div0 crash
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
gdk_monitor_get_geometry() may return 0-size, and leads to crash:
https://bugzilla.redhat.com/show_bug.cgi?id=1941627
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
---
src/spice-widget.c | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/spice-widget.c b/src/spice-widget.c
index 7ee02a8..afcf45a 100644
--- a/src/spice-widget.c
+++ b/src/spice-widget.c
@@ -1379,9 +1379,11 @@ static void recalc_geometry(GtkWidget *widget)
width_mm = gdk_monitor_get_width_mm(monitor);
gdk_monitor_get_geometry(monitor, &geometry);
/* FIXME: gives wrong results atm: https://gitlab.gnome.org/GNOME/gtk/-/issues/3066 */
- width_mm = (width_mm * d->ww / geometry.width) / zoom * scale_factor;
- height_mm = (height_mm * d->wh / geometry.height) / zoom * scale_factor;
- has_display_mm = true;
+ if (geometry.width > 0 && geometry.height > 0) {
+ width_mm = (width_mm * d->ww / geometry.width) / zoom * scale_factor;
+ height_mm = (height_mm * d->wh / geometry.height) / zoom * scale_factor;
+ has_display_mm = true;
+ }
}
DISPLAY_DEBUG(display,
--
2.29.0

View File

@ -2,7 +2,7 @@
Name: spice-gtk Name: spice-gtk
Version: 0.39 Version: 0.39
Release: 2%{?dist} Release: 3%{?dist}
Summary: A GTK+ widget for SPICE clients Summary: A GTK+ widget for SPICE clients
License: LGPLv2+ License: LGPLv2+
@ -12,6 +12,8 @@ Source0: https://www.spice-space.org/download/gtk/%{name}-%{version}%{?_v
Source1: https://www.spice-space.org/download/gtk/%{name}-%{version}%{?_version_suffix}.tar.xz.sig Source1: https://www.spice-space.org/download/gtk/%{name}-%{version}%{?_version_suffix}.tar.xz.sig
Source2: victortoso-E37A484F.keyring Source2: victortoso-E37A484F.keyring
Patch0001: 0001-Fix-potential-div0-crash.patch
BuildRequires: git-core BuildRequires: git-core
BuildRequires: meson BuildRequires: meson
BuildRequires: intltool BuildRequires: intltool
@ -196,6 +198,9 @@ gpgv2 --quiet --keyring %{SOURCE2} %{SOURCE1} %{SOURCE0}
%{_bindir}/spicy-stats %{_bindir}/spicy-stats
%changelog %changelog
* Mon Jun 28 2021 Marc-André Lureau <marcandre.lureau@redhat.com> - 0.39-3
- Fix potential div/0. Resolves: rhbz#1941627
* Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.39-2 * Wed Jan 27 2021 Fedora Release Engineering <releng@fedoraproject.org> - 0.39-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild