From e2beb68834251f2f6273a415b7887603f8ba0785 Mon Sep 17 00:00:00 2001 From: "G. Richard Bellamy" Date: Sun, 31 Jan 2016 11:16:02 -0800 Subject: [PATCH] Backport patch to fix upstream bug Upstream bug: https://bugzilla.gnome.org/show_bug.cgi?id=759658 Patches xprops so that it handles null-terminated strings output by xcb. --- ...rops-Null-terminate-property-reply-values.patch | 52 ++++++++++++++++++++++ trunk/PKGBUILD | 13 ++++-- 2 files changed, 61 insertions(+), 4 deletions(-) create mode 100644 trunk/0001-xprops-Null-terminate-property-reply-values.patch diff --git a/trunk/0001-xprops-Null-terminate-property-reply-values.patch b/trunk/0001-xprops-Null-terminate-property-reply-values.patch new file mode 100644 index 0000000..3a196df --- /dev/null +++ b/trunk/0001-xprops-Null-terminate-property-reply-values.patch @@ -0,0 +1,52 @@ +From 723a27e280cbe3f4d7975b7f35217b5600bfbe00 Mon Sep 17 00:00:00 2001 +From: Sebastian Keller +Date: Sun, 10 Jan 2016 04:15:09 +0100 +Subject: [PATCH] xprops: Null-terminate property reply values + +Some of the mutter code using these properties expects them to be +null-terminated whereas xcb does not use null-terminated strings: + +http://xcb.freedesktop.org/XcbRationale/ + +This was in some cases resulting in the WM_CLASS property containing +garbage data which broke application matching, caused the hot-corner and +window-switcher to stop working, or was exposed as text in the UI. + +https://bugzilla.gnome.org/show_bug.cgi?id=759658 +--- + src/x11/xprops.c | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/src/x11/xprops.c b/src/x11/xprops.c +index be38824..e3bd931 100644 +--- a/src/x11/xprops.c ++++ b/src/x11/xprops.c +@@ -194,6 +194,7 @@ async_get_property_finish (xcb_connection_t *xcb_conn, + { + xcb_get_property_reply_t *reply; + xcb_generic_error_t *error; ++ int length; + + reply = xcb_get_property_reply (xcb_conn, cookie, &error); + if (error) +@@ -209,8 +210,15 @@ async_get_property_finish (xcb_connection_t *xcb_conn, + results->prop = NULL; + + if (results->type != None) +- results->prop = g_memdup (xcb_get_property_value (reply), +- xcb_get_property_value_length (reply)); ++ { ++ length = xcb_get_property_value_length (reply); ++ /* Leave room for a trailing '\0' since xcb doesn't return null-terminated ++ * strings ++ */ ++ results->prop = g_malloc (length + 1); ++ memcpy (results->prop, xcb_get_property_value (reply), length); ++ results->prop[length] = '\0'; ++ } + + free (reply); + return (results->prop != NULL); +-- +2.5.0 + diff --git a/trunk/PKGBUILD b/trunk/PKGBUILD index bd6be95..4186b04 100644 --- a/trunk/PKGBUILD +++ b/trunk/PKGBUILD @@ -1,11 +1,11 @@ -# $Id$ +# $Id: PKGBUILD 250820 2015-11-12 21:02:27Z heftig $ # Maintainer: Jan Alexander Steffens (heftig) # Maintainer: Ionut Biru # Contributor: Michael Kanis pkgname=mutter pkgver=3.18.2 -pkgrel=1 +pkgrel=2 pkgdesc="A window manager for GNOME" arch=(i686 x86_64) license=('GPL') @@ -17,11 +17,16 @@ url="http://www.gnome.org" groups=('gnome') options=('!emptydirs') install=mutter.install -source=(https://download.gnome.org/sources/$pkgname/${pkgver:0:4}/$pkgname-$pkgver.tar.xz) -sha256sums=('8a69326f216c7575ed6cd53938b9cfc49b3b359cde95d3b6a7ed46c837261181') +source=( + http://ftp.gnome.org/pub/gnome/sources/$pkgname/${pkgver:0:4}/$pkgname-$pkgver.tar.xz + 0001-xprops-Null-terminate-property-reply-values.patch + ) +sha256sums=('8a69326f216c7575ed6cd53938b9cfc49b3b359cde95d3b6a7ed46c837261181' + 'f31015bf497166c7c85780449f336d80513dd75efa26e736014672c95d0a4605') prepare() { cd "$pkgname-$pkgver" + patch -Np1 < "${srcdir}/0001-xprops-Null-terminate-property-reply-values.patch" } build() { -- 2.7.0