From bf94d3735bad138b0422b6364b32e1893b2062c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Mon, 28 Jun 2021 20:38:14 +0400 Subject: [PATCH] Fix sigfpe. Resolves: rhbz#1941627 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Marc-André Lureau --- 0001-Fix-potential-div0-crash.patch | 38 +++++++++++++++++++++++++++++ spice-gtk.spec | 7 +++++- 2 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 0001-Fix-potential-div0-crash.patch diff --git a/0001-Fix-potential-div0-crash.patch b/0001-Fix-potential-div0-crash.patch new file mode 100644 index 0000000..2d299b8 --- /dev/null +++ b/0001-Fix-potential-div0-crash.patch @@ -0,0 +1,38 @@ +From edba707b32d47977e14f576854f61a0c1a569eab Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= +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 +--- + 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 + diff --git a/spice-gtk.spec b/spice-gtk.spec index 576ade7..8f1eb84 100644 --- a/spice-gtk.spec +++ b/spice-gtk.spec @@ -2,7 +2,7 @@ Name: spice-gtk Version: 0.39 -Release: 2%{?dist} +Release: 3%{?dist} Summary: A GTK+ widget for SPICE clients 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 Source2: victortoso-E37A484F.keyring +Patch0001: 0001-Fix-potential-div0-crash.patch + BuildRequires: git-core BuildRequires: meson BuildRequires: intltool @@ -196,6 +198,9 @@ gpgv2 --quiet --keyring %{SOURCE2} %{SOURCE1} %{SOURCE0} %{_bindir}/spicy-stats %changelog +* Mon Jun 28 2021 Marc-André Lureau - 0.39-3 +- Fix potential div/0. Resolves: rhbz#1941627 + * Wed Jan 27 2021 Fedora Release Engineering - 0.39-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild