unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* libgd security CVE-2016-7568
@ 2016-09-29 15:38 Leo Famulari
  2016-10-01 12:20 ` Ludovic Courtès
  0 siblings, 1 reply; 3+ messages in thread
From: Leo Famulari @ 2016-09-29 15:38 UTC (permalink / raw)
  To: guix-devel


[-- Attachment #1.1: Type: text/plain, Size: 151 bytes --]

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

[-- Attachment #1.2: 0001-gnu-gd-Fix-CVE-2016-7568.patch --]
[-- Type: text/plain, Size: 3476 bytes --]

From b125d20c4e60cfd204a99fd7df174de73df067a2 Mon Sep 17 00:00:00 2001
From: Leo Famulari <leo@famulari.name>
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 =						\
   %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/patches/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=CVE-2016-7568
+
+Patch copied from upstream source repository:
+
+https://github.com/libgd/libgd/commit/2806adfdc27a94d333199345394d7c302952b95f
+
+From 2806adfdc27a94d333199345394d7c302952b95f Mon Sep 17 00:00:00 2001
+From: trylab <trylab@users.noreply.github.com>
+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, 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.10.0
+
-- 
2.10.0


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: libgd security CVE-2016-7568
  2016-09-29 15:38 libgd security CVE-2016-7568 Leo Famulari
@ 2016-10-01 12:20 ` Ludovic Courtès
  2016-10-01 16:27   ` Leo Famulari
  0 siblings, 1 reply; 3+ messages in thread
From: Ludovic Courtès @ 2016-10-01 12:20 UTC (permalink / raw)
  To: Leo Famulari; +Cc: guix-devel

Leo Famulari <leo@famulari.name> skribis:

> 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
>
> From b125d20c4e60cfd204a99fd7df174de73df067a2 Mon Sep 17 00:00:00 2001
> From: Leo Famulari <leo@famulari.name>
> 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.

LGTM, thanks!

Ludo'.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: libgd security CVE-2016-7568
  2016-10-01 12:20 ` Ludovic Courtès
@ 2016-10-01 16:27   ` Leo Famulari
  0 siblings, 0 replies; 3+ messages in thread
From: Leo Famulari @ 2016-10-01 16:27 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

On Sat, Oct 01, 2016 at 02:20:35PM +0200, Ludovic Courtès wrote:
> Leo Famulari <leo@famulari.name> skribis:
> 
> > 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
> >
> > From b125d20c4e60cfd204a99fd7df174de73df067a2 Mon Sep 17 00:00:00 2001
> > From: Leo Famulari <leo@famulari.name>
> > 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.
> 
> LGTM, thanks!

Pushed!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-10-01 16:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-29 15:38 libgd security CVE-2016-7568 Leo Famulari
2016-10-01 12:20 ` Ludovic Courtès
2016-10-01 16:27   ` Leo Famulari

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).