aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2019-05-21 10:57:22 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2019-05-21 10:57:22 +0200
commit789d3a37e656167a63e637140805fac145c765ea (patch)
treed965b27ce852bd7262c26459815d457f6bf5a2bf
parent6981e9bb0cd51d22b06dd4241a55f6e08f60e75d (diff)
parent20353e96a390a029f7b3b18fc7ddd82eae98b935 (diff)
downloadnx-libs-789d3a37e656167a63e637140805fac145c765ea.tar.gz
nx-libs-789d3a37e656167a63e637140805fac145c765ea.tar.bz2
nx-libs-789d3a37e656167a63e637140805fac145c765ea.zip
Merge branch 'uli42-pr/fix_xkb_crash' into 3.6.x
Attributes GH PR #809: https://github.com/ArcticaProject/nx-libs/pull/809
-rw-r--r--nx-X11/lib/src/xkb/XKBBind.c14
-rw-r--r--nx-X11/programs/Xserver/xkb/xkbUtils.c4
2 files changed, 18 insertions, 0 deletions
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;
diff --git a/nx-X11/programs/Xserver/xkb/xkbUtils.c b/nx-X11/programs/Xserver/xkb/xkbUtils.c
index 028f32454..21a5ce76a 100644
--- a/nx-X11/programs/Xserver/xkb/xkbUtils.c
+++ b/nx-X11/programs/Xserver/xkb/xkbUtils.c
@@ -685,6 +685,10 @@ unsigned act;
else group= newGroup;
}
else {
+#ifdef NXAGENT_SERVER
+ /* we have seen division by zero here */
+ if (ctrls->num_groups != 0)
+#endif
group%= ctrls->num_groups;
}
}