summaryrefslogtreecommitdiff
path: root/xfixes
diff options
context:
space:
mode:
authorAdam Jackson <ajax@redhat.com>2014-04-10 11:34:28 -0400
committerKeith Packard <keithp@keithp.com>2014-04-22 07:50:17 -0700
commitba2432a020a9f9bd0892f643117795336ba0fc16 (patch)
treee5f7bc7921b98d90aa462c225d1f47843a322a62 /xfixes
parent70e564104b69bc53d29633f392f2c1ab94caddc9 (diff)
xfixes: Forbid manipulating clip for source-only pictures (#28968)
Just throw BadPicture instead of crashing. It's not currently a meaningful thing to do anyway, RenderSetPictureRectangles would error if you tried (which this patch changes to BadPicture as well for consistency). The problem with trying to do it is if the clip is specified as a pixmap then we try to convert it to a region, and ->BitmapToRegion requires a ScreenPtr, and source-only pictures don't have one. I can imagine a use for client clip on source-only pictures, so if we really wanted to allow this, probably the way forward is to always store the clip as a region internally, and when setting the clip _from_ a pixmap, look up BitmapToRegion relative to the pixmap not the picture. But since clearly nobody can be relying on it working... Signed-off-by: Adam Jackson <ajax@redhat.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Keith Packard <keithp@keithp.com> Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'xfixes')
-rw-r--r--xfixes/region.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/xfixes/region.c b/xfixes/region.c
index cc8f1a5ef..f9de52542 100644
--- a/xfixes/region.c
+++ b/xfixes/region.c
@@ -269,6 +269,9 @@ ProcXFixesCreateRegionFromPicture(ClientPtr client)
VERIFY_PICTURE(pPicture, stuff->picture, client, DixGetAttrAccess);
+ if (!pPicture->pDrawable)
+ return RenderErrBase + BadPicture;
+
switch (pPicture->clientClipType) {
case CT_PIXMAP:
pRegion = BitmapToRegion(pPicture->pDrawable->pScreen,
@@ -750,6 +753,9 @@ ProcXFixesSetPictureClipRegion(ClientPtr client)
VERIFY_PICTURE(pPicture, stuff->picture, client, DixSetAttrAccess);
VERIFY_REGION_OR_NONE(pRegion, stuff->region, client, DixReadAccess);
+ if (!pPicture->pDrawable)
+ return RenderErrBase + BadPicture;
+
return SetPictureClipRegion(pPicture, stuff->xOrigin, stuff->yOrigin,
pRegion);
}