Previously the code would rely on xalloc(0) to return NULL and so in case
either width or height is zero return an error to the client. It's better
to be explicit though so add a check and return BadAlloc in that case.

Signed-off-by: Tomas Carnecky <[email protected]>
---
 render/render.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/render/render.c b/render/render.c
index 45856a7..041a2d7 100644
--- a/render/render.c
+++ b/render/render.c
@@ -1531,7 +1531,9 @@ ProcRenderCreateCursor (ClientPtr client)
     pScreen = pSrc->pDrawable->pScreen;
     width = pSrc->pDrawable->width;
     height = pSrc->pDrawable->height;
-    if (height && width > UINT32_MAX/(height*sizeof(CARD32)))
+    if (width == 0 || height == 0)
+           return (BadAlloc);
+    if (width > UINT32_MAX/(height*sizeof(CARD32)))
        return BadAlloc;
     if ( stuff->x > width 
       || stuff->y > height )
-- 
1.6.5.4


_______________________________________________
xorg-devel mailing list
[email protected]
http://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to