Imported Debian patch 2:1.15.1-0ubuntu2.6
[deb_xorg-server.git] / debian / patches / CVE-2014-8xxx / 0002-dix-integer-overflow-in-ProcPutImage-CVE-2014-8092-1.patch
CommitLineData
7217e0ca
ML
1From 7e17b41d2907afd82d668f25694e1da12e34895e Mon Sep 17 00:00:00 2001
2From: Alan Coopersmith <alan.coopersmith@oracle.com>
3Date: Wed, 22 Jan 2014 21:11:16 -0800
4Subject: [PATCH 02/33] dix: integer overflow in ProcPutImage() [CVE-2014-8092
5 1/4]
6
7ProcPutImage() calculates a length field from a width, left pad and depth
8specified by the client (if the specified format is XYPixmap).
9
10The calculations for the total amount of memory the server needs for the
11pixmap can overflow a 32-bit number, causing out-of-bounds memory writes
12on 32-bit systems (since the length is stored in a long int variable).
13
14Reported-by: Ilja Van Sprundel <ivansprundel@ioactive.com>
15Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
16Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
17---
18 dix/dispatch.c | 3 +++
19 1 file changed, 3 insertions(+)
20
21Index: xorg-server-1.15.1/dix/dispatch.c
22===================================================================
23--- xorg-server-1.15.1.orig/dix/dispatch.c 2014-12-04 11:52:11.007847226 -0500
24+++ xorg-server-1.15.1/dix/dispatch.c 2014-12-04 11:52:10.975847036 -0500
25@@ -1957,6 +1957,9 @@
26 tmpImage = (char *) &stuff[1];
27 lengthProto = length;
28
29+ if (lengthProto >= (INT32_MAX / stuff->height))
30+ return BadLength;
31+
32 if ((bytes_to_int32(lengthProto * stuff->height) +
33 bytes_to_int32(sizeof(xPutImageReq))) != client->req_len)
34 return BadLength;