0005-Xi-Do-not-try-to-swap-GenericEvent.patch 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. From ba336b24052122b136486961c82deac76bbde455 Mon Sep 17 00:00:00 2001
  2. From: Michal Srb <msrb@suse.com>
  3. Date: Wed, 24 May 2017 15:54:42 +0300
  4. Subject: [PATCH] Xi: Do not try to swap GenericEvent.
  5. The SProcXSendExtensionEvent must not attempt to swap GenericEvent because
  6. it is assuming that the event has fixed size and gives the swapping function
  7. xEvent-sized buffer.
  8. A GenericEvent would be later rejected by ProcXSendExtensionEvent anyway.
  9. Signed-off-by: Michal Srb <msrb@suse.com>
  10. Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
  11. Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
  12. Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
  13. ---
  14. Xi/sendexev.c | 10 +++++++++-
  15. 1 file changed, 9 insertions(+), 1 deletion(-)
  16. diff --git a/Xi/sendexev.c b/Xi/sendexev.c
  17. index 5e63bfcca..5c2e0fc56 100644
  18. --- a/Xi/sendexev.c
  19. +++ b/Xi/sendexev.c
  20. @@ -95,9 +95,17 @@ SProcXSendExtensionEvent(ClientPtr client)
  21. eventP = (xEvent *) &stuff[1];
  22. for (i = 0; i < stuff->num_events; i++, eventP++) {
  23. + if (eventP->u.u.type == GenericEvent) {
  24. + client->errorValue = eventP->u.u.type;
  25. + return BadValue;
  26. + }
  27. +
  28. proc = EventSwapVector[eventP->u.u.type & 0177];
  29. - if (proc == NotImplemented) /* no swapping proc; invalid event type? */
  30. + /* no swapping proc; invalid event type? */
  31. + if (proc == NotImplemented) {
  32. + client->errorValue = eventP->u.u.type;
  33. return BadValue;
  34. + }
  35. (*proc) (eventP, &eventT);
  36. *eventP = eventT;
  37. }
  38. --
  39. 2.11.0