Commit a3759f32 authored by Olivier Fourdan's avatar Olivier Fourdan Committed by Ulrich Sibiller

XKB: fix XkbGetKeyboardByName with Xming server

XkbGetKeyboardByName relies on flags to read the data from the server. If the X server sends us the wrong flags or if a subreply is smaller than it should be, XkbGetKeyboardByName will not read all the available data and leave data in the buffer, which will cause the next _XReply() to fail with: [xcb] Extra reply data still left in queue [xcb] This is most likely caused by a broken X extension library [xcb] Aborting, sorry about that. xcb_io.c:576: _XReply: Assertion `!xcb_xlib_extra_reply_data_left' failed. Aborted Check if there is some extra data left at the end of XkbGetKeyboardByName() and discard that data if any is found. Many thanks to Peter Hutterer <peter.hutterer@who-t.net> for finding the root cause of the issue and Adam Jackson <ajax@redhat.com> for helping with the analysis! Signed-off-by: 's avatarOlivier Fourdan <ofourdan@redhat.com> Reviewed-by: 's avatarDaniel Stone <daniels@collabora.com> Reviewed-by: 's avatarPeter Hutterer <peter.hutterer@who-t.net> Signed-off-by: 's avatarPeter Hutterer <peter.hutterer@who-t.net> Backported-to-NX-by: 's avatarUlrich Sibiller <uli42@gmx.de>
parent 50192b72
......@@ -44,7 +44,7 @@ XkbGetKeyboardByName(Display *dpy,
{
register xkbGetKbdByNameReq *req;
xkbGetKbdByNameReply rep;
int len, extraLen;
int len, extraLen = 0;
char *str;
XkbDescPtr xkb;
int mapLen, codesLen, typesLen, compatLen;
......@@ -204,12 +204,16 @@ XkbGetKeyboardByName(Display *dpy,
if (status != Success)
goto BAILOUT;
}
if (extraLen > 0)
goto BAILOUT;
UnlockDisplay(dpy);
SyncHandle();
return xkb;
BAILOUT:
if (xkb != NULL)
XkbFreeKeyboard(xkb, XkbAllComponentsMask, xTrue);
if (extraLen > 0)
_XEatData(dpy, extraLen);
UnlockDisplay(dpy);
SyncHandle();
return NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment