gd: Security Advisory CVE-2016-7568
PATCH v2 1/1 gd: Security Advisory CVE-2016-7568
Changed in V2:
In V1 forgot to add SOB(Singed-off-by) in source code patch.
Backport patch to fix CVE-2016-7568 from gd upstream:
https://github.com/libgd/libgd/commit/2806adfdc27a94d333199345394d7c302952b95f
Signed-off-by Dengke Du <[email protected]>
--- ...01-Fix-integer-overflow-in-gdImageWebpCtx.patch | 42 ++++++++++++++++++++++ meta-oe/recipes-support/gd/gd_2.2.3.bb | 1 + 2 files changed, 43 insertions(+) create mode 100644 meta-oe/recipes-support/gd/gd/0001-Fix-integer-overflow-in-gdImageWebpCtx.patch
meta-oe/recipes-support/gd/gd/0001-Fix-integer-overflow-in-gdImageWebpCtx.patch new file +42 -0
@@ -0,0 +1,42 @@ +From 2806adfdc27a94d333199345394d7c302952b95f Mon Sep 17 00:00:00 2001 +From: trylab <[email protected]> +Date: Tue, 6 Sep 2016 18:35:32 +0800 +Subject: [PATCH] Fix integer overflow in gdImageWebpCtx + +Integer overflow can be happened in expression gdImageSX(im) * 4 * +gdImageSY(im). It could lead to heap buffer overflow in the following +code. This issue has been reported to the PHP Bug Tracking System. The +proof-of-concept file will be supplied some days later. This issue was +discovered by Ke Liu of Tencent's Xuanwu LAB. + +Upstream-Status: Backport + +CVE-2016-7568 + +Signed-off-by: Dengke Du <[email protected]> +--- + src/gd_webp.c | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/src/gd_webp.c b/src/gd_webp.c +index 8eb4dee..9886399 100644 +--- a/src/gd_webp.c ++++ b/src/gd_webp.c +@@ -199,6 +199,14 @@ BGD_DECLARE(void) gdImageWebpCtx (gdImagePtr im, gdIOCtx * outfile, int quality) + quality = 80; + } + ++ if (overflow2(gdImageSX(im), 4)) { ++ return; ++ } ++ ++ if (overflow2(gdImageSX(im) * 4, gdImageSY(im))) { ++ return; ++ } ++ + argb = (uint8_t *)gdMalloc(gdImageSX(im) * 4 * gdImageSY(im)); + if (!argb) { + return; +-- +2.9.3 +
meta-oe/recipes-support/gd/gd_2.2.3.bb +1 -0
@@ -15,6 +15,7 @@ DEPENDS = "freetype libpng jpeg zlib tiff" SRC_URI = "git://github.com/libgd/libgd.git;branch=GD-2.2 \ file://fix-gcc-unused-functions.patch \ file://disable-jpeg_read-test.patch \ + file://0001-Fix-integer-overflow-in-gdImageWebpCtx.patch \ " SRCREV = "46ceef5970bf3a847ff61d1bdde7501d66c11d0c"
Signature · 1 line
2.7.4