From 282a4dcaabc5f0cd6f7d3819aa648333b93b265e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Mon, 8 Jan 2007 19:22:41 +0100 Subject: [PATCH] Attempt to fix drawable type checks in dixLookupDrawable(). Not sure this is 100% correct either, but it fixes at least one reproducible crasher where it returned a pixmap to dixLookupWindow(). --- dix/dixutils.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dix/dixutils.c b/dix/dixutils.c index 084d2e4c5..e530360fe 100644 --- a/dix/dixutils.c +++ b/dix/dixutils.c @@ -219,7 +219,7 @@ dixLookupDrawable(DrawablePtr *pDraw, XID id, ClientPtr client, pTmp = client->lastDrawable; /* an access check is required for cached drawables */ - rtype = (pTmp->type | M_WINDOW) ? RT_WINDOW : RT_PIXMAP; + rtype = (type & M_WINDOW) ? RT_WINDOW : RT_PIXMAP; if (!XaceHook(XACE_RESOURCE_ACCESS, client, id, rtype, access, pTmp)) return BadDrawable; } else @@ -227,10 +227,10 @@ dixLookupDrawable(DrawablePtr *pDraw, XID id, ClientPtr client, access); if (!pTmp) return BadDrawable; - if (!((1 << pTmp->type) | (type ? type : M_DRAWABLE))) + if (!((1 << pTmp->type) & (type ? type : M_DRAWABLE))) return BadMatch; - if (pTmp->type | M_DRAWABLE) { + if (type & M_DRAWABLE) { client->lastDrawable = pTmp; client->lastDrawableID = id; client->lastGCID = INVALID;