summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Packard <keithp@keithp.com>2015-01-03 08:46:45 -0800
committerJulien Cristau <jcristau@debian.org>2015-01-05 18:22:51 +0100
commitf39ac527baab8a38d023e3a8416757ccfcead42a (patch)
treed1ac5290b44d37e5a19c75a2248fe85fba5e4d2f
parent16f157cbf6b9c3193b4e622b9c4552e83a343e9d (diff)
dix: Allow zero-height PutImage requests
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> (cherry picked from commit dc777c346d5d452a53b13b917c45f6a1bad2f20b) Signed-off-by: Julien Cristau <jcristau@debian.org>
-rw-r--r--dix/dispatch.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/dix/dispatch.c b/dix/dispatch.c
index 01820bc0f..4e24e627f 100644
--- a/dix/dispatch.c
+++ b/dix/dispatch.c
@@ -1956,7 +1956,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) +