aboutsummaryrefslogtreecommitdiffstats
path: root/main/gd/CVE-2016-7568.patch
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2016-10-21 13:08:24 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2016-10-21 13:09:28 +0000
commite75858307e07c46124b8f604df3a02f0f2c88dbf (patch)
treef5c17f0cfe7c055356229fd9479f9f5dbb06cb60 /main/gd/CVE-2016-7568.patch
parentac6549fa3988c594c16d11ac9e00abca0cc8c3ec (diff)
downloadaports-e75858307e07c46124b8f604df3a02f0f2c88dbf.tar.bz2
aports-e75858307e07c46124b8f604df3a02f0f2c88dbf.tar.xz
main/gd: security fix for CVE-2016-7568
fixes #6342
Diffstat (limited to 'main/gd/CVE-2016-7568.patch')
-rw-r--r--main/gd/CVE-2016-7568.patch33
1 files changed, 33 insertions, 0 deletions
diff --git a/main/gd/CVE-2016-7568.patch b/main/gd/CVE-2016-7568.patch
new file mode 100644
index 0000000000..56156411e3
--- /dev/null
+++ b/main/gd/CVE-2016-7568.patch
@@ -0,0 +1,33 @@
+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;