diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2012-02-16 15:11:40 +1000 |
---|---|---|
committer | Jeremy Huddleston <jeremyhu@apple.com> | 2012-03-30 14:44:02 -0700 |
commit | bc8dc7183b50800470080eaa9c04cfd6ecc3591b (patch) | |
tree | 9c94a248ed2c0af49740e6763728acea6389bc0a | |
parent | 1e2a7462bec388342424f22ebf77a6fd3f177d7d (diff) |
Xext: return BadAccess if PickPointer fails (#45796)
PickPointer or PickKeyboard return NULL, all MDs are currently disabled and
we cannot emulate a core event. This wasn't anticipated by the protocol, so
we don't really have an error code we may use here - BadAccess is simply the
least bad of the possible ones.
And returning BadAccess beats crashing the server.
X.Org Bug 45796 <http://bugs.freedesktop.org/show_bug.cgi?id=45796>
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
(cherry picked from commit 6b6afd3d013e3f4910fae3520d1d786df2b0e47a)
-rw-r--r-- | Xext/xtest.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Xext/xtest.c b/Xext/xtest.c index 241445759..e659b4154 100644 --- a/Xext/xtest.c +++ b/Xext/xtest.c @@ -118,6 +118,10 @@ ProcXTestCompareCursor(ClientPtr client) rc = dixLookupWindow(&pWin, stuff->window, client, DixGetAttrAccess); if (rc != Success) return rc; + + if (!ptr) + return BadAccess; + if (stuff->cursor == None) pCursor = NullCursor; else if (stuff->cursor == XTestCurrentCursor) @@ -307,9 +311,15 @@ ProcXTestFakeInput(ClientPtr client) return BadValue; } + /* Technically the protocol doesn't allow for BadAccess here but + * this can only happen when all MDs are disabled. */ + if (!dev) + return BadAccess; + dev = GetXTestDevice(dev); } + /* If the event has a time set, wait for it to pass */ if (ev->u.keyButtonPointer.time) { TimeStamp activateTime; |