Skip to content

Commit

Permalink
dix: Allow zero-height PutImage requests
Browse files Browse the repository at this point in the history
The length checking code validates PutImage height and byte width by
making sure that byte-width >= INT32_MAX / height. If height is zero,
this generates a divide by zero exception. Allow zero height requests
explicitly, bypassing the INT32_MAX check.

Signed-off-by: Keith Packard <keithp@keithp.com>
Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com>
  • Loading branch information
keith-packard committed Jan 4, 2015
1 parent 924996c commit dc777c3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion dix/dispatch.c
Expand Up @@ -2000,7 +2000,7 @@ ProcPutImage(ClientPtr client)
tmpImage = (char *) &stuff[1];
lengthProto = length;

if (lengthProto >= (INT32_MAX / stuff->height))
if (stuff->height != 0 && lengthProto >= (INT32_MAX / stuff->height))
return BadLength;

if ((bytes_to_int32(lengthProto * stuff->height) +
Expand Down

0 comments on commit dc777c3

Please sign in to comment.