[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#929499: Crash in XKeycodeToKeysym()



Package: src:nx-libs
Version: 2:3.5.99.19-2
Severity: important
Tags: patch fixed-upstream
Forwarded: https://github.com/ArcticaProject/nx-libs/issues/801

In libnx-x11, it was found that pointers (dpy, xkb) are referenced without them being checked for being NULL or valid object pointers.

This was fixed by this upstream PR:
https://github.com/ArcticaProject/nx-libs/pull/809

Mike
--

DAS-NETZWERKTEAM
c\o Technik- und Ökologiezentrum Eckernförde
Mike Gabriel, Marienthaler str. 17, 24340 Eckernförde
mobile: +49 (1520) 1976 148
landline: +49 (4354) 8390 139

GnuPG Fingerprint: 9BFB AEE8 6C0A A5FF BF22  0782 9AF4 6B30 2577 1B31
mail: mike.gabriel@das-netzwerkteam.de, http://das-netzwerkteam.de

>From 20353e96a390a029f7b3b18fc7ddd82eae98b935 Mon Sep 17 00:00:00 2001
From: Ulrich Sibiller <uli42@gmx.de>
Date: Wed, 15 May 2019 19:54:24 +0200
Subject: [PATCH 2/2] libNX_X11: add additional checks for dpy and xkb

We have seen crashes during session shutdown/connection problems
here. These patches should avoid them. There's no proper way to test
them, but they should do no harm..

Fixes ArcticaProject/nx-libs#801
Fixes https://bugs.x2go.org/cgi-bin/bugreport.cgi?bug=695
---
 nx-X11/lib/src/xkb/XKBBind.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/nx-X11/lib/src/xkb/XKBBind.c b/nx-X11/lib/src/xkb/XKBBind.c
index 068e8f2a0..ffe5ad9d7 100644
--- a/nx-X11/lib/src/xkb/XKBBind.c
+++ b/nx-X11/lib/src/xkb/XKBBind.c
@@ -108,7 +108,21 @@ XKeycodeToKeysym(Display *dpy,
 
     _XkbCheckPendingRefresh(dpy, dpy->xkb_info);
 
+#ifdef NX_TRANS_SOCKET
+    /*
+       check again, we have seen cases where the connection broke
+       during CheckPendingEvents(), followed by a crash when accessing
+       dpy. See https://github.com/ArcticaProject/nx-libs/issues/801
+    */
+    if (_XkbUnavailable(dpy))
+        return _XKeycodeToKeysym(dpy, kc, col);
+#endif
+
     xkb = dpy->xkb_info->desc;
+#ifdef NX_TRANS_SOCKET
+    if (xkb == NULL)
+        return _XKeycodeToKeysym(dpy, kc, col);
+#endif
     if ((kc < xkb->min_key_code) || (kc > xkb->max_key_code))
         return NoSymbol;
 
-- 
2.20.1

Attachment: pgpS0scD8z5lz.pgp
Description: Digitale PGP-Signatur


Reply to: