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>
This commit is contained in:
Thomas Klausner 2013-09-04 20:05:51 +02:00 committed by Peter Hutterer
parent 1110b71e36
commit 47218a6e09

View File

@ -2864,18 +2864,25 @@ ProcCreateCursor(ClientPtr client)
return rc; return rc;
} }
rc = dixLookupResourceByType((pointer *) &msk, stuff->mask, RT_PIXMAP, if (src->drawable.depth != 1)
client, DixReadAccess); return (BadMatch);
if (rc != Success) {
if (stuff->mask != None) { /* 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; client->errorValue = stuff->mask;
return rc; 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 else
|| src->drawable.height != msk->drawable.height msk = NULL;
|| src->drawable.depth != 1 || msk->drawable.depth != 1)
return BadMatch;
width = src->drawable.width; width = src->drawable.width;
height = src->drawable.height; height = src->drawable.height;