[PATCH] Remove the SendEvent bit (0x80) before doing range checks on event type.
sam.spilsbury at canonical.com
Tue Sep 13 18:58:34 PDT 2011
Some extension libraries may set this bit before converting the event to
wire protocol and as such range checking the event will cause an invalid
BadValue error to result. As the documentation suggests the the bit
should be "forced on", remove it before doing range checks and continue
to force it on in the server.
dix/events.c | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/dix/events.c b/dix/events.c
index 8a4c6b9..9e58edb 100644
@@ -5224,6 +5224,8 @@ CloseDownEvents(void)
InputEventList = NULL;
+#define SEND_EVENT_BIT 0x80
* Server-side protocol handling for SendEvent request.
@@ -5241,6 +5243,16 @@ ProcSendEvent(ClientPtr client)
+ /* libXext and other extension libraries may set the bit indicating
+ * that this event came from a SendEvent request so remove it
+ * since otherwise the event type may fail the range checks
+ * and cause an invalid BadValue error to be returned.
+ * This is safe to do since we later add the SendEvent bit (0x80)
+ * back in once we send the event to the client */
+ stuff->event.u.u.type &= ~(SEND_EVENT_BIT);
/* The client's event type must be a core event type or one defined by an
@@ -5298,7 +5310,7 @@ ProcSendEvent(ClientPtr client)
client->errorValue = stuff->propagate;
- stuff->event.u.u.type |= 0x80;
+ stuff->event.u.u.type |= SEND_EVENT_BIT;
for (;pWin; pWin = pWin->parent)
More information about the xorg-devel