summary refs log tree commit diff
diff options
context:
space:
mode:
authorLeo Famulari <leo@famulari.name>2016-10-15 15:31:01 -0400
committerLeo Famulari <leo@famulari.name>2016-10-15 15:31:49 -0400
commite1376e25a755a7368d095b4eb2daf42be9e63b0d (patch)
treeb305eafaac27ce72400be12134ffaf0b53d97683
parent6f30a55c9660cc87227faa3a4c7300bd51e79e4e (diff)
downloadguix-e1376e25a755a7368d095b4eb2daf42be9e63b0d.tar.gz
gnu: gd: Fix CVE-2016-8670.
* gnu/packages/patches/gd-CVE-2016-8670.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
* gnu/packages/gd.scm (gd)[source]: Use it.
-rw-r--r--gnu/local.mk1
-rw-r--r--gnu/packages/gd.scm1
-rw-r--r--gnu/packages/patches/gd-CVE-2016-8670.patch38
3 files changed, 40 insertions, 0 deletions
diff --git a/gnu/local.mk b/gnu/local.mk
index a9343f009f..06e23cd6d8 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -535,6 +535,7 @@ dist_patch_DATA =						\
   %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-CVE-2016-8670.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 6c94d35bdf..0241a81db9 100644
--- a/gnu/packages/gd.scm
+++ b/gnu/packages/gd.scm
@@ -51,6 +51,7 @@
               (base32
                "0g3xz8jpz1pl2zzmssglrpa9nxiaa7rmcmvgpbrjz8k9cyynqsvl"))
              (patches (search-patches "gd-CVE-2016-7568.patch"
+                                      "gd-CVE-2016-8670.patch"
                                       "gd-fix-gd2-read-test.patch"
                                       "gd-fix-tests-on-i686.patch"))))
     (build-system gnu-build-system)
diff --git a/gnu/packages/patches/gd-CVE-2016-8670.patch b/gnu/packages/patches/gd-CVE-2016-8670.patch
new file mode 100644
index 0000000000..39ee99ac31
--- /dev/null
+++ b/gnu/packages/patches/gd-CVE-2016-8670.patch
@@ -0,0 +1,38 @@
+Fix CVE-2016-8670 (buffer overflow in dynamicGetbuf()):
+
+https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-8670
+http://seclists.org/oss-sec/2016/q4/138
+
+Patch copied from upstream source repository:
+
+https://github.com/libgd/libgd/commit/53110871935244816bbb9d131da0bccff734bfe9
+
+From 53110871935244816bbb9d131da0bccff734bfe9 Mon Sep 17 00:00:00 2001
+From: "Christoph M. Becker" <cmbecker69@gmx.de>
+Date: Wed, 12 Oct 2016 11:15:32 +0200
+Subject: [PATCH] Avoid potentially dangerous signed to unsigned conversion
+
+We make sure to never pass a negative `rlen` as size to memcpy(). See
+also <https://bugs.php.net/bug.php?id=73280>.
+
+Patch provided by Emmanuel Law.
+---
+ src/gd_io_dp.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/gd_io_dp.c b/src/gd_io_dp.c
+index 135eda3..228bfa5 100644
+--- a/src/gd_io_dp.c
++++ b/src/gd_io_dp.c
+@@ -276,7 +276,7 @@ static int dynamicGetbuf(gdIOCtxPtr ctx, void *buf, int len)
+ 	if(remain >= len) {
+ 		rlen = len;
+ 	} else {
+-		if(remain == 0) {
++		if(remain <= 0) {
+ 			/* 2.0.34: EOF is incorrect. We use 0 for
+ 			 * errors and EOF, just like fileGetbuf,
+ 			 * which is a simple fread() wrapper.
+-- 
+2.10.1
+