gnu: gd: Incorporate grafted changes.

* gnu/packages/gd.scm (gd)[replacement]: Remove field.
[source]: Update to 2.2.4. Remove patches 'gd-CVE-2016-7568.patch' and
'gd-CVE-2016-8670.patch'.
[arguments]: New field.
(gd-2.2.4): Remove variable.
* gnu/packages/patches/gd-CVE-2016-7568.patch,
gnu/packages/patches/gd-CVE-2016-8670.patch: Delete files.
* gnu/local.mk (dist_patch_DATA): Remove them.
This commit is contained in:
Leo Famulari 2017-01-25 13:03:04 -05:00
parent 4158b1d123
commit c134959b96
No known key found for this signature in database
GPG Key ID: 2646FA30BACA7F08
4 changed files with 14 additions and 116 deletions

View File

@ -569,8 +569,6 @@ dist_patch_DATA = \
%D%/packages/patches/gcc-6-arm-none-eabi-multilib.patch \ %D%/packages/patches/gcc-6-arm-none-eabi-multilib.patch \
%D%/packages/patches/gcc-6-cross-environment-variables.patch \ %D%/packages/patches/gcc-6-cross-environment-variables.patch \
%D%/packages/patches/gcj-arm-mode.patch \ %D%/packages/patches/gcj-arm-mode.patch \
%D%/packages/patches/gd-CVE-2016-7568.patch \
%D%/packages/patches/gd-CVE-2016-8670.patch \
%D%/packages/patches/gd-fix-chunk-size-on-boundaries.patch \ %D%/packages/patches/gd-fix-chunk-size-on-boundaries.patch \
%D%/packages/patches/gd-fix-gd2-read-test.patch \ %D%/packages/patches/gd-fix-gd2-read-test.patch \
%D%/packages/patches/gd-fix-tests-on-i686.patch \ %D%/packages/patches/gd-fix-tests-on-i686.patch \

View File

@ -36,12 +36,11 @@
(define-public gd (define-public gd
(package (package
(name "gd") (name "gd")
(replacement gd-2.2.4)
;; Note: With libgd.org now pointing to github.com, genuine old ;; Note: With libgd.org now pointing to github.com, genuine old
;; tarballs are no longer available. Notably, versions 2.0.x are ;; tarballs are no longer available. Notably, versions 2.0.x are
;; missing. ;; missing.
(version "2.2.3") (version "2.2.4")
(source (origin (source (origin
(method url-fetch) (method url-fetch)
@ -50,12 +49,21 @@
version "/libgd-" version ".tar.xz")) version "/libgd-" version ".tar.xz"))
(sha256 (sha256
(base32 (base32
"0g3xz8jpz1pl2zzmssglrpa9nxiaa7rmcmvgpbrjz8k9cyynqsvl")) "1rp4v7n1dq38b92kl7gkvpvqqkw7nvdfnz6d5kip5klkxfki6zqk"))
(patches (search-patches "gd-CVE-2016-7568.patch" (patches (search-patches "gd-fix-gd2-read-test.patch"
"gd-CVE-2016-8670.patch"
"gd-fix-gd2-read-test.patch"
"gd-fix-tests-on-i686.patch")))) "gd-fix-tests-on-i686.patch"))))
(build-system gnu-build-system) (build-system gnu-build-system)
(arguments
`(#:phases
(modify-phases %standard-phases
;; This test is known to fail on i686-linux:
;; https://github.com/libgd/libgd/issues/359
;; TODO Replace this substitution with an upstream bug fix.
(add-after 'unpack 'disable-failing-test
(lambda _
(substitute* "tests/gdimagegrayscale/basic.c"
(("return gdNumFailures\\(\\)")
"return 0")))))))
(native-inputs (native-inputs
`(("pkg-config" ,pkg-config))) `(("pkg-config" ,pkg-config)))
(inputs (inputs
@ -78,32 +86,6 @@ most common applications of GD involve website development.")
"See COPYING file in the distribution.")) "See COPYING file in the distribution."))
(properties '((cpe-name . "libgd"))))) (properties '((cpe-name . "libgd")))))
(define gd-2.2.4
(package
(inherit gd)
(version "2.2.4")
(source
(origin
(method url-fetch)
(uri (string-append "https://github.com/libgd/libgd/releases/download/"
"gd-" version "/libgd-" version ".tar.xz"))
(patches (search-patches "gd-fix-gd2-read-test.patch"
"gd-fix-tests-on-i686.patch"))
(sha256
(base32
"1rp4v7n1dq38b92kl7gkvpvqqkw7nvdfnz6d5kip5klkxfki6zqk"))))
(arguments
`(#:phases
(modify-phases %standard-phases
;; This test is known to fail on i686-linux:
;; https://github.com/libgd/libgd/issues/359
;; TODO Replace this substitution with an upstream bug fix.
(add-after 'unpack 'disable-failing-test
(lambda _
(substitute* "tests/gdimagegrayscale/basic.c"
(("return gdNumFailures\\(\\)")
"return 0")))))))))
(define-public perl-gd (define-public perl-gd
(package (package
(name "perl-gd") (name "perl-gd")

View File

@ -1,44 +0,0 @@
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

View File

@ -1,38 +0,0 @@
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