From 883a200fc6df76898f3b41cae164140bf3735876 Mon Sep 17 00:00:00 2001 From: Jan Grulich Date: Wed, 15 Feb 2023 09:53:58 +0100 Subject: [PATCH] Backport: Sanity check when cleaning up keymap changes --- ...heck-when-cleaning-up-keymap-changes.patch | 28 +++++++++++++++++++ tigervnc.spec | 11 ++++++-- 2 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 tigervnc-sanity-check-when-cleaning-up-keymap-changes.patch diff --git a/tigervnc-sanity-check-when-cleaning-up-keymap-changes.patch b/tigervnc-sanity-check-when-cleaning-up-keymap-changes.patch new file mode 100644 index 0000000..012a741 --- /dev/null +++ b/tigervnc-sanity-check-when-cleaning-up-keymap-changes.patch @@ -0,0 +1,28 @@ +From 774c6bcf33b5c9b94c1ff12895775e77c555decc Mon Sep 17 00:00:00 2001 +From: Pierre Ossman +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; diff --git a/tigervnc.spec b/tigervnc.spec index 44e39f2..b41100c 100644 --- a/tigervnc.spec +++ b/tigervnc.spec @@ -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 - 1.13.0-2 +- Backport: Sanity check when cleaning up keymap changes + * Tue Feb 07 2023 Jan Grulich - 1.13.0-1 - 1.13.0 - CVE-2023-0494