summary refs log tree commit diff
path: root/gnu/packages/patches/gd-CVE-2018-5711.patch
diff options
context:
space:
mode:
authorJulien Lepiller <julien@lepiller.eu>2018-03-01 20:34:51 +0100
committerJulien Lepiller <julien@lepiller.eu>2018-03-01 22:25:28 +0100
commit8147d7c675e663c45d5e1ccbeebb72daeaba0b91 (patch)
tree588402c7f346b57e3161b64aab79c34cc78855f4 /gnu/packages/patches/gd-CVE-2018-5711.patch
parent738aa0ca1d1b86286cf8f57620a50c4b093031b8 (diff)
downloadguix-8147d7c675e663c45d5e1ccbeebb72daeaba0b91.tar.gz
gnu: php: Fix test failure.
* gnu/packages/php.scm (php)[inputs]: Use gd-for-php.
(gd-for-php): New private variable.
* gnu/packages/patches/gd-CVE-2018-5711.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it.
Diffstat (limited to 'gnu/packages/patches/gd-CVE-2018-5711.patch')
-rw-r--r--gnu/packages/patches/gd-CVE-2018-5711.patch61
1 files changed, 61 insertions, 0 deletions
diff --git a/gnu/packages/patches/gd-CVE-2018-5711.patch b/gnu/packages/patches/gd-CVE-2018-5711.patch
new file mode 100644
index 0000000000..83b12cde63
--- /dev/null
+++ b/gnu/packages/patches/gd-CVE-2018-5711.patch
@@ -0,0 +1,61 @@
+This patch is adapted from commit a11f47475e6443b7f32d21f2271f28f417e2ac04 and
+fixes CVE-2018-5711.
+
+From a11f47475e6443b7f32d21f2271f28f417e2ac04 Mon Sep 17 00:00:00 2001
+From: "Christoph M. Becker" <cmbecker69@gmx.de>
+Date: Wed, 29 Nov 2017 19:37:38 +0100
+Subject: [PATCH] Fix #420: Potential infinite loop in gdImageCreateFromGifCtx
+
+Due to a signedness confusion in `GetCode_` a corrupt GIF file can
+trigger an infinite loop.  Furthermore we make sure that a GIF without
+any palette entries is treated as invalid *after* open palette entries
+have been removed.
+
+CVE-2018-5711
+
+See also https://bugs.php.net/bug.php?id=75571.
+---
+ src/gd_gif_in.c             |  12 ++++++------
+ 1 file changed, 38 insertions(+), 6 deletions(-)
+
+diff --git a/src/gd_gif_in.c b/src/gd_gif_in.c
+index daf26e7..0a8bd71 100644
+--- a/src/gd_gif_in.c
++++ b/src/gd_gif_in.c
+@@ -335,11 +335,6 @@ terminated:
+ 		return 0;
+ 	}
+ 
+-	if(!im->colorsTotal) {
+-		gdImageDestroy(im);
+-		return 0;
+-	}
+-
+ 	/* Check for open colors at the end, so
+ 	 * we can reduce colorsTotal and ultimately
+ 	 * BitsPerPixel */
+@@ -351,6 +346,11 @@ terminated:
+ 		}
+ 	}
+ 
++	if(!im->colorsTotal) {
++		gdImageDestroy(im);
++		return 0;
++	}
++
+ 	return im;
+ }
+ 
+@@ -447,7 +447,7 @@ static int
+ GetCode_(gdIOCtx *fd, CODE_STATIC_DATA *scd, int code_size, int flag, int *ZeroDataBlockP)
+ {
+ 	int i, j, ret;
+-	unsigned char count;
++	int count;
+ 
+ 	if(flag) {
+ 		scd->curbit = 0;
+
+-- 
+2.13.6
+