[PATCH] render: Avoid infinite loops in alpha map handling (#23581)

Adam Jackson ajax at redhat.com
Mon May 10 12:34:53 PDT 2010


Don't allow setting the alpha map of a picture to itself, or to a
picture that already has an alpha map, to prevent cycles.

Signed-off-by: Adam Jackson <ajax at redhat.com>
---
 render/picture.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/render/picture.c b/render/picture.c
index 48693b8..902cc20 100644
--- a/render/picture.c
+++ b/render/picture.c
@@ -1119,7 +1119,9 @@ ChangePicture (PicturePtr	pPicture,
 			    break;
 			}
 			if (pAlpha->pDrawable == NULL ||
-			    pAlpha->pDrawable->type != DRAWABLE_PIXMAP)
+			    pAlpha->pDrawable->type != DRAWABLE_PIXMAP ||
+			    pAlpha == pPicture ||
+			    pAlpha->alphaMap != NULL)
 			{
 			    client->errorValue = pid;
 			    error = BadMatch;
-- 
1.7.0.1



More information about the xorg-devel mailing list