<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif;font-size:small">+ Peter of course!</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 21 January 2016 at 09:58, Olivier Fourdan <span dir="ltr"><<a href="mailto:ofourdan@redhat.com" target="_blank">ofourdan@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">XkbGetKeyboardByName relies on flags to read the data from the server.<br>
<br>
If the X server sends us the wrong flags or if a subreply is smaller<br>
than it should be, XkbGetKeyboardByName will not read all the available<br>
data and leave data in the buffer, which will cause the next _XReply()<br>
to fail with:<br>
<br>
[xcb] Extra reply data still left in queue<br>
[xcb] This is most likely caused by a broken X extension library<br>
[xcb] Aborting, sorry about that.<br>
xcb_io.c:576: _XReply: Assertion `!xcb_xlib_extra_reply_data_left' failed.<br>
Aborted<br>
<br>
Check if there is some extra data left at the end of<br>
XkbGetKeyboardByName() and discard that data if any is found.<br>
<br>
Many thanks to Peter Hutterer <<a href="mailto:peter.hutterer@who-t.net">peter.hutterer@who-t.net</a>> for finding the<br>
root cause of the issue and Adam Jackson <<a href="mailto:ajax@redhat.com">ajax@redhat.com</a>> for helping<br>
with the analysis!<br>
<br>
Signed-off-by: Olivier Fourdan <<a href="mailto:ofourdan@redhat.com">ofourdan@redhat.com</a>><br>
---<br>
src/xkb/XKBGetByName.c | 17 ++++++++++++++++-<br>
1 file changed, 16 insertions(+), 1 deletion(-)<br>
<br>
diff --git a/src/xkb/XKBGetByName.c b/src/xkb/XKBGetByName.c<br>
index 973052c..01927fc 100644<br>
--- a/src/xkb/XKBGetByName.c<br>
+++ b/src/xkb/XKBGetByName.c<br>
@@ -28,12 +28,23 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.<br>
#ifdef HAVE_CONFIG_H<br>
#include <config.h><br>
#endif<br>
+#include <stdio.h><br>
+<br>
#include "Xlibint.h"<br>
#include <X11/extensions/XKBproto.h><br>
#include "XKBlibint.h"<br>
<br>
/***====================================================================***/<br>
<br>
+static void<br>
+_discardExtraLen(Display *dpy, int extraLen)<br>
+{<br>
+ fprintf(stderr,<br>
+ "XkbGetKeyboardByName: server returned wrong data, discarding %i bytes\n",<br>
+ extraLen);<br>
+ _XEatData(dpy, extraLen);<br>
+}<br>
+<br>
XkbDescPtr<br>
XkbGetKeyboardByName(Display *dpy,<br>
unsigned deviceSpec,<br>
@@ -44,7 +55,7 @@ XkbGetKeyboardByName(Display *dpy,<br>
{<br>
register xkbGetKbdByNameReq *req;<br>
xkbGetKbdByNameReply rep;<br>
- int len, extraLen;<br>
+ int len, extraLen = 0;<br>
char *str;<br>
XkbDescPtr xkb;<br>
int mapLen, codesLen, typesLen, compatLen;<br>
@@ -204,12 +215,16 @@ XkbGetKeyboardByName(Display *dpy,<br>
if (status != Success)<br>
goto BAILOUT;<br>
}<br>
+ if (extraLen > 0)<br>
+ _discardExtraLen(dpy, extraLen);<br>
UnlockDisplay(dpy);<br>
SyncHandle();<br>
return xkb;<br>
BAILOUT:<br>
if (xkb != NULL)<br>
XkbFreeKeyboard(xkb, XkbAllComponentsMask, xTrue);<br>
+ if (extraLen > 0)<br>
+ _discardExtraLen(dpy, extraLen);<br>
UnlockDisplay(dpy);<br>
SyncHandle();<br>
return NULL;<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.5.0<br>
<br>
_______________________________________________<br>
<a href="mailto:xorg-devel@lists.x.org">xorg-devel@lists.x.org</a>: X.Org development<br>
Archives: <a href="http://lists.x.org/archives/xorg-devel" rel="noreferrer" target="_blank">http://lists.x.org/archives/xorg-devel</a><br>
Info: <a href="http://lists.x.org/mailman/listinfo/xorg-devel" rel="noreferrer" target="_blank">http://lists.x.org/mailman/listinfo/xorg-devel</a></font></span></blockquote></div><br></div>