From mboxrd@z Thu Jan 1 00:00:00 1970 From: Leo Famulari Subject: libgd security CVE-2016-7568 Date: Thu, 29 Sep 2016 11:38:18 -0400 Message-ID: <20160929153818.GA30722@jasmine> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="MW5yreqqjyrRcusr" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46925) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpdPu-0005qj-WF for guix-devel@gnu.org; Thu, 29 Sep 2016 11:38:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bpdPq-0001kz-0j for guix-devel@gnu.org; Thu, 29 Sep 2016 11:38:34 -0400 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:39851) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bpdPo-0001fB-NC for guix-devel@gnu.org; Thu, 29 Sep 2016 11:38:29 -0400 Received: from localhost (static-96-245-220-114.phlapa.fios.verizon.net [96.245.220.114]) by mail.messagingengine.com (Postfix) with ESMTPA id 9CD49F29CF for ; Thu, 29 Sep 2016 11:38:19 -0400 (EDT) Content-Disposition: inline List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: guix-devel@gnu.org --MW5yreqqjyrRcusr Content-Type: multipart/mixed; boundary="3V7upXqbjpZ4EhLz" Content-Disposition: inline --3V7upXqbjpZ4EhLz Content-Type: text/plain; charset=us-ascii Content-Disposition: inline This patches fixes an integer overflow in libgd: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-7568 http://seclists.org/oss-sec/2016/q3/639 --3V7upXqbjpZ4EhLz Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="0001-gnu-gd-Fix-CVE-2016-7568.patch" Content-Transfer-Encoding: quoted-printable =46rom b125d20c4e60cfd204a99fd7df174de73df067a2 Mon Sep 17 00:00:00 2001 =46rom: Leo Famulari Date: Thu, 29 Sep 2016 11:32:34 -0400 Subject: [PATCH] gnu: gd: Fix CVE-2016-7568. * gnu/packages/patches/gd-CVE-2016-7568.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. * gnu/packages/gd.scm (gd)[source]: Use it. --- gnu/local.mk | 1 + gnu/packages/gd.scm | 3 +- gnu/packages/patches/gd-CVE-2016-7568.patch | 44 +++++++++++++++++++++++++= ++++ 3 files changed, 47 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/gd-CVE-2016-7568.patch diff --git a/gnu/local.mk b/gnu/local.mk index b864ea9..3a9cb2d 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -529,6 +529,7 @@ dist_patch_DATA =3D \ %D%/packages/patches/gcc-cross-environment-variables.patch \ %D%/packages/patches/gcc-libvtv-runpath.patch \ %D%/packages/patches/gcc-5.0-libvtv-runpath.patch \ + %D%/packages/patches/gd-CVE-2016-7568.patch \ %D%/packages/patches/gd-fix-gd2-read-test.patch \ %D%/packages/patches/gd-fix-tests-on-i686.patch \ %D%/packages/patches/gegl-CVE-2012-4433.patch \ diff --git a/gnu/packages/gd.scm b/gnu/packages/gd.scm index 4ba0194..6c94d35 100644 --- a/gnu/packages/gd.scm +++ b/gnu/packages/gd.scm @@ -50,7 +50,8 @@ (sha256 (base32 "0g3xz8jpz1pl2zzmssglrpa9nxiaa7rmcmvgpbrjz8k9cyynqsvl")) - (patches (search-patches "gd-fix-gd2-read-test.patch" + (patches (search-patches "gd-CVE-2016-7568.patch" + "gd-fix-gd2-read-test.patch" "gd-fix-tests-on-i686.patch")))) (build-system gnu-build-system) (native-inputs diff --git a/gnu/packages/patches/gd-CVE-2016-7568.patch b/gnu/packages/pat= ches/gd-CVE-2016-7568.patch new file mode 100644 index 0000000..6a1a632 --- /dev/null +++ b/gnu/packages/patches/gd-CVE-2016-7568.patch @@ -0,0 +1,44 @@ +Fix CVE-2016-7568 (integer overflow in gdImageWebpCtx()): + +https://cve.mitre.org/cgi-bin/cvename.cgi?name=3DCVE-2016-7568 + +Patch copied from upstream source repository: + +https://github.com/libgd/libgd/commit/2806adfdc27a94d333199345394d7c302952= b95f + +From 2806adfdc27a94d333199345394d7c302952b95f Mon Sep 17 00:00:00 2001 +From: trylab +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. +--- + 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, gdIO= Ctx * outfile, int quality) + quality =3D 80; + } +=20 ++ if (overflow2(gdImageSX(im), 4)) { ++ return; ++ } ++ ++ if (overflow2(gdImageSX(im) * 4, gdImageSY(im))) { ++ return; ++ } ++ + argb =3D (uint8_t *)gdMalloc(gdImageSX(im) * 4 * gdImageSY(im)); + if (!argb) { + return; +--=20 +2.10.0 + --=20 2.10.0 --3V7upXqbjpZ4EhLz-- --MW5yreqqjyrRcusr Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJX7TVmAAoJECZG+jC6yn8IXQIP/i+/jTFxOSyjg6wlRRgLNZBv 4zLd9gRMXpW0+2nOPO4K29BJ98sfeRBpghhQY+9rHl9Ml538LXjurQ7G9efxh2mN btyG8sHcJeUUcs/Ri7M77EHCqCJ1X1g/wNRE2TO/FNcQeUYNVbUy7hRkVynCi5UM DdTFPNUARrB79KVFujbIX3bKvbQ9JDD+NyLZn4eBrTl3Tl6cj9HoXHE+DM0Zncii g93KkpiZxrhdglBp8FHLOVXHyH/h3gFAuEaULDI7v/myYEI9uQ8vvaOIo+Zhan9u 29plhqo3n/ZgIFM9DqupqNc8sUUbBRZc16BxLFgHlIjlJiT/chprMFbgbKTPfV96 yCtADLD7P6QVgeav1nU2YrY4kD/xKTFIf1VeunDfT7GuKl67SiokivNvT35QNTOv RyE5Fd7gh+MOA4mE3f0b3NKnnQa82r53i52n3wyemcbMUYWILeQrtJ0c1LCo6ITn eSW4HtvGj/c1Vg3KEpd4P9gUI0b6ycHugaADZw1hBcVK+/qQjAuOoEMHcaq+OuRC fhxX5urba44sEYFnwysFqDUGe/8ko495TxjvNjV8Uth45l+Do1IWVm70mj0bivil ILZXjAla1TV3/VG243qmjjgbF0CBUCCzgt9YiUMNw23joVe5bf1qx2f8NGlV9+Sl zB9+R9bnvXzGCaP1XVx1 =CehK -----END PGP SIGNATURE----- --MW5yreqqjyrRcusr--