summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCatalin Enache <catalin.enache@windriver.com>2017-04-06 14:08:36 +0300
committerMartin Jansa <Martin.Jansa@gmail.com>2017-04-18 14:21:38 +0200
commitf882211c14507894248bb4ff064153b242d1d9d7 (patch)
tree0b8edd0d3881228e68b0643a1e2fc5540e9e8228
parenteb97a736f339c70a102cc07871be7da3b711b68c (diff)
downloadmeta-openembedded-f882211c14507894248bb4ff064153b242d1d9d7.tar.gz
gd : CVE-2016-10166
Integer underflow in the _gdContributionsAlloc function in gd_interpolation.c in the GD Graphics Library (aka libgd) before 2.2.4 allows remote attackers to have unspecified impact via vectors related to decrementing the u variable. Reference: http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2016-10166 Upstream patch: https://github.com/libgd/libgd/commit/60bfb401ad5a4a8ae995dcd36372fe15c71e1a35 Signed-off-by: Catalin Enache <catalin.enache@windriver.com> Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
-rw-r--r--meta-oe/recipes-support/gd/gd/CVE-2016-10166.patch60
-rw-r--r--meta-oe/recipes-support/gd/gd_2.2.3.bb3
2 files changed, 62 insertions, 1 deletions
diff --git a/meta-oe/recipes-support/gd/gd/CVE-2016-10166.patch b/meta-oe/recipes-support/gd/gd/CVE-2016-10166.patch
new file mode 100644
index 000000000..7ccfbeabc
--- /dev/null
+++ b/meta-oe/recipes-support/gd/gd/CVE-2016-10166.patch
@@ -0,0 +1,60 @@
1From c92240c1670c20c2f854761d3a89ab61dd158c91 Mon Sep 17 00:00:00 2001
2From: "Christoph M. Becker" <cmbecker69@gmx.de>
3Date: Sat, 6 Aug 2016 10:08:53 +0200
4Subject: [PATCH] Fix potential unsigned underflow
5
6No need to decrease `u`, so we don't do it. While we're at it, we also factor
7out the overflow check of the loop, what improves performance and readability.
8
9This issue has been reported by Stefan Esser to security@libgd.org.
10
11Upstream-Status: Backport
12CVE: CVE-2016-10166
13
14Signed-off-by: Catalin Enache <catalin.enache@windriver.com>
15---
16 src/gd_interpolation.c | 19 ++++++++++---------
17 1 file changed, 10 insertions(+), 9 deletions(-)
18
19diff --git a/src/gd_interpolation.c b/src/gd_interpolation.c
20index 7e7943d..9944349 100644
21--- a/src/gd_interpolation.c
22+++ b/src/gd_interpolation.c
23@@ -829,8 +829,13 @@ static inline LineContribType * _gdContributionsAlloc(unsigned int line_length,
24 {
25 unsigned int u = 0;
26 LineContribType *res;
27- int overflow_error = 0;
28+ size_t weights_size;
29
30+ if (overflow2(windows_size, sizeof(double))) {
31+ return NULL;
32+ } else {
33+ weights_size = windows_size * sizeof(double);
34+ }
35 res = (LineContribType *) gdMalloc(sizeof(LineContribType));
36 if (!res) {
37 return NULL;
38@@ -847,15 +852,11 @@ static inline LineContribType * _gdContributionsAlloc(unsigned int line_length,
39 return NULL;
40 }
41 for (u = 0 ; u < line_length ; u++) {
42- if (overflow2(windows_size, sizeof(double))) {
43- overflow_error = 1;
44- } else {
45- res->ContribRow[u].Weights = (double *) gdMalloc(windows_size * sizeof(double));
46- }
47- if (overflow_error == 1 || res->ContribRow[u].Weights == NULL) {
48+ res->ContribRow[u].Weights = (double *) gdMalloc(weights_size);
49+ if (res->ContribRow[u].Weights == NULL) {
50 unsigned int i;
51- u--;
52- for (i=0;i<=u;i++) {
53+
54+ for (i=0;i<u;i++) {
55 gdFree(res->ContribRow[i].Weights);
56 }
57 gdFree(res->ContribRow);
58--
592.10.2
60
diff --git a/meta-oe/recipes-support/gd/gd_2.2.3.bb b/meta-oe/recipes-support/gd/gd_2.2.3.bb
index c5aff6616..4ff6b756a 100644
--- a/meta-oe/recipes-support/gd/gd_2.2.3.bb
+++ b/meta-oe/recipes-support/gd/gd_2.2.3.bb
@@ -13,7 +13,8 @@ LIC_FILES_CHKSUM = "file://COPYING;md5=c97638cafd3581eb87abd37332137669"
13DEPENDS = "freetype libpng jpeg zlib tiff" 13DEPENDS = "freetype libpng jpeg zlib tiff"
14 14
15SRC_URI = "git://github.com/libgd/libgd.git;branch=GD-2.2 \ 15SRC_URI = "git://github.com/libgd/libgd.git;branch=GD-2.2 \
16 file://fix-gcc-unused-functions.patch" 16 file://fix-gcc-unused-functions.patch \
17 file://CVE-2016-10166.patch"
17 18
18SRCREV = "46ceef5970bf3a847ff61d1bdde7501d66c11d0c" 19SRCREV = "46ceef5970bf3a847ff61d1bdde7501d66c11d0c"
19 20