From bfee96b1b954b49fff3064d2ab22bd0f71775984 Mon Sep 17 00:00:00 2001 From: Iain Lane 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