Bug#910070: xdg-screensaver: libdbus assertion when window title is not valid UTF-8

Iain Lane iain.lane at canonical.com
Tue Oct 2 10:53:09 BST 2018


Package: xdg-utils
Version: 1.1.2
Severity: normal
Tags: patch upstream

Control: forwarded -1 https://bugs.freedesktop.org/show_bug.cgi?id=108121

Hi,

This was first reported in Launchpad, but it affects Debian too.

If the window title that 'suspend's argument refers to is invalid UTF-8
then the spawned perl process will crash with an assertion. We notice
more in Ubuntu because this causes a crash pop-up - without that then
the problem is probably that suspend hasn't worked.

A patch is attached to fix this by sanitising the window name. I thought
you might like to apply that in Debian.

Cheers,

-- 
Iain Lane                                  [ iain at orangesquash.org.uk ]
Debian Developer                                   [ laney at debian.org ]
Ubuntu Developer                                   [ laney at ubuntu.com ]
-------------- next part --------------
>From bfee96b1b954b49fff3064d2ab22bd0f71775984 Mon Sep 17 00:00:00 2001
From: Iain Lane <iain.lane at canonical.com>
Date: Tue, 2 Oct 2018 10:29:03 +0100
Subject: [PATCH] xdg-screensaver: Sanitise window name before sending it over
 the bus

libdbus expects string arguments to be valid UTF-8. If they are not,
then it aborts, which causes our backgrounded command to terminate
abnormally.
---
 scripts/xdg-screensaver.in | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/scripts/xdg-screensaver.in b/scripts/xdg-screensaver.in
index 9e68196..ccb4307 100644
--- a/scripts/xdg-screensaver.in
+++ b/scripts/xdg-screensaver.in
@@ -468,6 +468,7 @@ screensaver_gnome_screensaver()
         perl -e '
 use strict;
 use warnings;
+use Encode qw(decode);
 use IO::File;
 use Net::DBus;
 use X11::Protocol;
@@ -489,6 +490,10 @@ while (1) {
   }
 }
 
+# Replace any invalid unicode characters with U+FFFD, so we dont crash when we
+# pass them over to D-Bus
+$window_name = decode("utf8", $window_name, Encode::FB_DEFAULT);
+
 # Inhibit idle detection (flags = 8) with window name and ID.
 # We have no reason so just send the window name again.
 my $bus = Net::DBus->session();
-- 
2.17.0



More information about the Pkg-freedesktop-maintainers mailing list