summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Andresan <Dan.Andresan@enea.com>2018-10-29 12:01:34 +0100
committerGerrit Code Review <gerrit2@sestogerrit02>2018-10-29 12:01:34 +0100
commit3ca74f08b0a97f4675cbdd07497e8eaaaf05cfb2 (patch)
tree095c9fc7db73471eecf1ddbb6e1ccd1c21e8b625
parent1fd90264695d95bc6a84409283cd6d002c0b0e35 (diff)
parent2596922ee809af9fb48a0fc684bb560563de0994 (diff)
downloadmeta-el-common-3ca74f08b0a97f4675cbdd07497e8eaaaf05cfb2.tar.gz
Merge "libxcursor: Fix CVE-2017-16612" into pyro
-rw-r--r--recipes-graphics/xorg-lib/libxcursor/CVE-2017-16612-Fix-heap-overflows-when-parsing-malicious-files.patch78
-rw-r--r--recipes-graphics/xorg-lib/libxcursor_1.1.14.bbappend6
2 files changed, 84 insertions, 0 deletions
diff --git a/recipes-graphics/xorg-lib/libxcursor/CVE-2017-16612-Fix-heap-overflows-when-parsing-malicious-files.patch b/recipes-graphics/xorg-lib/libxcursor/CVE-2017-16612-Fix-heap-overflows-when-parsing-malicious-files.patch
new file mode 100644
index 0000000..9cad31e
--- /dev/null
+++ b/recipes-graphics/xorg-lib/libxcursor/CVE-2017-16612-Fix-heap-overflows-when-parsing-malicious-files.patch
@@ -0,0 +1,78 @@
1From 4794b5dd34688158fb51a2943032569d3780c4b8 Mon Sep 17 00:00:00 2001
2From: Tobias Stoeckmann <tobias@stoeckmann.org>
3Date: Sat, 21 Oct 2017 23:47:52 +0200
4Subject: [PATCH] Fix heap overflows when parsing malicious files.
5 (CVE-2017-16612)
6
7It is possible to trigger heap overflows due to an integer overflow
8while parsing images and a signedness issue while parsing comments.
9
10The integer overflow occurs because the chosen limit 0x10000 for
11dimensions is too large for 32 bit systems, because each pixel takes
124 bytes. Properly chosen values allow an overflow which in turn will
13lead to less allocated memory than needed for subsequent reads.
14
15The signedness bug is triggered by reading the length of a comment
16as unsigned int, but casting it to int when calling the function
17XcursorCommentCreate. Turning length into a negative value allows the
18check against XCURSOR_COMMENT_MAX_LEN to pass, and the following
19addition of sizeof (XcursorComment) + 1 makes it possible to allocate
20less memory than needed for subsequent reads.
21
22CVE: CVE-2017-16612
23Upstream-Status: Backport [https://cgit.freedesktop.org/xorg/lib/libXcursor/commit/?id=4794b5dd34688158fb51a2943032569d3780c4b8]
24
25Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
26Reviewed-by: Matthieu Herrb <matthieu@herrb.eu>
27Signed-off-by: Andreas Wellving <andreas.wellving@enea.com>
28---
29 src/file.c | 12 ++++++++++--
30 1 file changed, 10 insertions(+), 2 deletions(-)
31
32diff --git a/src/file.c b/src/file.c
33index 43163c2..da16277 100644
34--- a/src/file.c
35+++ b/src/file.c
36@@ -29,6 +29,11 @@ XcursorImageCreate (int width, int height)
37 {
38 XcursorImage *image;
39
40+ if (width < 0 || height < 0)
41+ return NULL;
42+ if (width > XCURSOR_IMAGE_MAX_SIZE || height > XCURSOR_IMAGE_MAX_SIZE)
43+ return NULL;
44+
45 image = malloc (sizeof (XcursorImage) +
46 width * height * sizeof (XcursorPixel));
47 if (!image)
48@@ -101,7 +106,7 @@ XcursorCommentCreate (XcursorUInt comment_type, int length)
49 {
50 XcursorComment *comment;
51
52- if (length > XCURSOR_COMMENT_MAX_LEN)
53+ if (length < 0 || length > XCURSOR_COMMENT_MAX_LEN)
54 return NULL;
55
56 comment = malloc (sizeof (XcursorComment) + length + 1);
57@@ -448,7 +453,8 @@ _XcursorReadImage (XcursorFile *file,
58 if (!_XcursorReadUInt (file, &head.delay))
59 return NULL;
60 /* sanity check data */
61- if (head.width >= 0x10000 || head.height > 0x10000)
62+ if (head.width > XCURSOR_IMAGE_MAX_SIZE ||
63+ head.height > XCURSOR_IMAGE_MAX_SIZE)
64 return NULL;
65 if (head.width == 0 || head.height == 0)
66 return NULL;
67@@ -457,6 +463,8 @@ _XcursorReadImage (XcursorFile *file,
68
69 /* Create the image and initialize it */
70 image = XcursorImageCreate (head.width, head.height);
71+ if (image == NULL)
72+ return NULL;
73 if (chunkHeader.version < image->version)
74 image->version = chunkHeader.version;
75 image->size = chunkHeader.subtype;
76--
772.7.4
78
diff --git a/recipes-graphics/xorg-lib/libxcursor_1.1.14.bbappend b/recipes-graphics/xorg-lib/libxcursor_1.1.14.bbappend
new file mode 100644
index 0000000..0f67cec
--- /dev/null
+++ b/recipes-graphics/xorg-lib/libxcursor_1.1.14.bbappend
@@ -0,0 +1,6 @@
1# look for files in the layer first
2FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
3
4SRC_URI += " \
5 file://CVE-2017-16612-Fix-heap-overflows-when-parsing-malicious-files.patch \
6 "