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
1 changed files with 15 additions and 8 deletions

View File

@ -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;