Backport: Sanity check when cleaning up keymap changes

This commit is contained in:
Jan Grulich 2023-02-15 09:53:58 +01:00
parent 23173a63d2
commit 883a200fc6
2 changed files with 36 additions and 3 deletions

View File

@ -0,0 +1,28 @@
From 774c6bcf33b5c9b94c1ff12895775e77c555decc Mon Sep 17 00:00:00 2001
From: Pierre Ossman <ossman@cendio.se>
Date: Thu, 9 Feb 2023 11:30:37 +0100
Subject: [PATCH] Sanity check when cleaning up keymap changes
Make sure we don't send a bogus request to the X server in the (common)
case that we don't actually have anything to restore.
(cherry picked from commit 1e3484f2017f038dd5149cd50741feaf39a680e4)
---
unix/x0vncserver/XDesktop.cxx | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/unix/x0vncserver/XDesktop.cxx b/unix/x0vncserver/XDesktop.cxx
index d5c6b2db9..f9c810968 100644
--- a/unix/x0vncserver/XDesktop.cxx
+++ b/unix/x0vncserver/XDesktop.cxx
@@ -481,6 +481,10 @@ void XDesktop::deleteAddedKeysyms(Display* dpy) {
}
}
+ // Did we actually find something to remove?
+ if (highestKeyCode < lowestKeyCode)
+ return;
+
changes.changed |= XkbKeySymsMask;
changes.first_key_sym = lowestKeyCode;
changes.num_key_syms = highestKeyCode - lowestKeyCode + 1;

View File

@ -4,7 +4,7 @@
Name: tigervnc
Version: 1.13.0
Release: 1%{?dist}
Release: 2%{?dist}
Summary: A TigerVNC remote display system
%global _hardened_build 1
@ -22,9 +22,10 @@ Source4: HOWTO.md
Source5: vncserver
# Downstream patches
Patch1: tigervnc-vncsession-restore-script-systemd-service.patch
# Upstream patches
Patch50: tigervnc-vncsession-restore-script-systemd-service.patch
Patch50: tigervnc-sanity-check-when-cleaning-up-keymap-changes.patch
# This is tigervnc-%%{version}/unix/xserver116.patch rebased on the latest xorg
Patch100: tigervnc-xserver120.patch
@ -145,7 +146,8 @@ runs properly under an environment with SELinux enabled.
%prep
%setup -q
%patch50 -p1 -b .vncsession-restore-script-systemd-service
%patch1 -p1 -b .vncsession-restore-script-systemd-service
%patch50 -p1 -b .sanity-check-when-cleaning-up-keymap-changes
cp -r /usr/share/xorg-x11-server-source/* unix/xserver
pushd unix/xserver
@ -329,6 +331,9 @@ fi
%ghost %verify(not md5 size mtime) %{_sharedstatedir}/selinux/%{selinuxtype}/active/modules/200/%{modulename}
%changelog
* Wed Feb 15 2023 Jan Grulich <jgrulich@redhat.com> - 1.13.0-2
- Backport: Sanity check when cleaning up keymap changes
* Tue Feb 07 2023 Jan Grulich <jgrulich@redhat.com> - 1.13.0-1
- 1.13.0
- CVE-2023-0494