summaryrefslogtreecommitdiff
path: root/dix
diff options
context:
space:
mode:
authorThomas Klausner <wiz@NetBSD.org>2013-09-04 20:05:51 +0200
committerPeter Hutterer <peter.hutterer@who-t.net>2013-09-06 07:04:18 +1000
commit47218a6e09549781fd61dbf5e0d3d5c81da64323 (patch)
tree2d7cb0b29dc1b63c214debddf144d670e2c64da0 /dix
parent1110b71e360195aab040d835b54540ab558638c5 (diff)
Fix bug in cursor handling.
CreateCursor (Xlib call XCreatePixmapCursor) with a non-bitmap source pixmap and a None mask is supposed to error out with BadMatch, but didn't. From der Mouse <mouse@Rodents-Montreal.ORG>, changed following comments by Alan Coopersmith <alan.coopersmith@oracle.com>. Signed-off-by: Thomas Klausner <wiz@NetBSD.org> Reviewed-by: Jasper St. Pierre <jstpierre@mecheye.net> Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'dix')
-rw-r--r--dix/dispatch.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/dix/dispatch.c b/dix/dispatch.c
index 51d0de25f..71fda4893 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -2864,18 +2864,25 @@ ProcCreateCursor(ClientPtr client)
return rc;
}
- rc = dixLookupResourceByType((pointer *) &msk, stuff->mask, RT_PIXMAP,
- client, DixReadAccess);
- if (rc != Success) {
- if (stuff->mask != None) {
+ if (src->drawable.depth != 1)
+ return (BadMatch);
+
+ /* Find and validate cursor mask pixmap, if one is provided */
+ if (stuff->mask != None) {
+ rc = dixLookupResourceByType((pointer *) &msk, stuff->mask, RT_PIXMAP,
+ client, DixReadAccess);
+ if (rc != Success) {
client->errorValue = stuff->mask;
return rc;
}
+
+ if (src->drawable.width != msk->drawable.width
+ || src->drawable.height != msk->drawable.height
+ || src->drawable.depth != 1 || msk->drawable.depth != 1)
+ return BadMatch;
}
- else if (src->drawable.width != msk->drawable.width
- || src->drawable.height != msk->drawable.height
- || src->drawable.depth != 1 || msk->drawable.depth != 1)
- return BadMatch;
+ else
+ msk = NULL;
width = src->drawable.width;
height = src->drawable.height;