From 53669d8e66afb4ba5fecefeea059963f644f3ad0 Mon Sep 17 00:00:00 2001 From: Peter Hutterer Date: Wed, 20 Jun 2018 11:44:46 +1000 Subject: [PATCH] Fix segfault in libinput list-devices --- ...valid-grab-parameter-to-list-devices.patch | 58 +++++++++++++++++++ libinput.spec | 7 ++- 2 files changed, 64 insertions(+), 1 deletion(-) create mode 100644 0001-tools-pass-a-valid-grab-parameter-to-list-devices.patch diff --git a/0001-tools-pass-a-valid-grab-parameter-to-list-devices.patch b/0001-tools-pass-a-valid-grab-parameter-to-list-devices.patch new file mode 100644 index 0000000..5334715 --- /dev/null +++ b/0001-tools-pass-a-valid-grab-parameter-to-list-devices.patch @@ -0,0 +1,58 @@ +From 7c51c881dc72827ca50ae9eea3d123eef9cb4a66 Mon Sep 17 00:00:00 2001 +From: Peter Hutterer +Date: Wed, 20 Jun 2018 07:56:05 +1000 +Subject: [PATCH libinput] tools: pass a valid grab parameter to list-devices + +My kingdome for a compiler warning. Or a scan-build warning. Or a coverity +warning. Or anything... But no, nothing. + +Also make the open_restricted() more robust to a NULL userdata, because +effectively that's what we were passing here. + +Fixes https://gitlab.freedesktop.org/libinput/libinput/issues/50 + +Introduced in 0a13223c39fdf0f079715bf83d498c0dcd9cf4f8 + +Signed-off-by: Peter Hutterer +--- + tools/libinput-list-devices.c | 3 ++- + tools/shared.c | 2 +- + 2 files changed, 3 insertions(+), 2 deletions(-) + +diff --git a/tools/libinput-list-devices.c b/tools/libinput-list-devices.c +index aa225ca0..4cbdf775 100644 +--- a/tools/libinput-list-devices.c ++++ b/tools/libinput-list-devices.c +@@ -372,6 +372,7 @@ main(int argc, char **argv) + { + struct libinput *li; + struct libinput_event *ev; ++ bool grab = false; + + /* This is kept for backwards-compatibility with the old + libinput-list-devices */ +@@ -388,7 +389,7 @@ main(int argc, char **argv) + } + } + +- li = tools_open_backend(BACKEND_UDEV, "seat0", false, false); ++ li = tools_open_backend(BACKEND_UDEV, "seat0", false, &grab); + if (!li) + return 1; + +diff --git a/tools/shared.c b/tools/shared.c +index d1f02702..d3fb6294 100644 +--- a/tools/shared.c ++++ b/tools/shared.c +@@ -232,7 +232,7 @@ open_restricted(const char *path, int flags, void *user_data) + if (fd < 0) + fprintf(stderr, "Failed to open %s (%s)\n", + path, strerror(errno)); +- else if (*grab && ioctl(fd, EVIOCGRAB, (void*)1) == -1) ++ else if (grab && *grab && ioctl(fd, EVIOCGRAB, (void*)1) == -1) + fprintf(stderr, "Grab requested, but failed for %s (%s)\n", + path, strerror(errno)); + +-- +2.17.1 + diff --git a/libinput.spec b/libinput.spec index 8a66221..a9ff3f9 100644 --- a/libinput.spec +++ b/libinput.spec @@ -5,7 +5,7 @@ Name: libinput Version: 1.11.1 -Release: 1%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist} +Release: 2%{?gitdate:.%{gitdate}git%{gitversion}}%{?dist} Summary: Input device library License: MIT @@ -18,6 +18,8 @@ Source2: commitid Source0: http://www.freedesktop.org/software/libinput/libinput-%{version}.tar.xz %endif +Patch01: 0001-tools-pass-a-valid-grab-parameter-to-list-devices.patch + BuildRequires: git-core BuildRequires: gcc gcc-c++ BuildRequires: meson @@ -113,6 +115,9 @@ The %{name}-utils package contains tools to debug hardware and analyze %{_mandir}/man1/libinput-replay.1* %changelog +* Wed Jun 20 2018 Peter Hutterer 1.11.1-2 +- Fix segfault in libinput list-devices + * Tue Jun 19 2018 Peter Hutterer 1.11.1-1 - libinput 1.11.1