From c134959b969303ae0c49a63399e6908c91eaa974 Mon Sep 17 00:00:00 2001 From: Leo Famulari Date: Wed, 25 Jan 2017 13:03:04 -0500 Subject: [PATCH] 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. --- gnu/local.mk | 2 - gnu/packages/gd.scm | 46 +++++++-------------- gnu/packages/patches/gd-CVE-2016-7568.patch | 44 -------------------- gnu/packages/patches/gd-CVE-2016-8670.patch | 38 ----------------- 4 files changed, 14 insertions(+), 116 deletions(-) delete mode 100644 gnu/packages/patches/gd-CVE-2016-7568.patch delete mode 100644 gnu/packages/patches/gd-CVE-2016-8670.patch diff --git a/gnu/local.mk b/gnu/local.mk index 9d835a8250..19048561dd 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -569,8 +569,6 @@ dist_patch_DATA = \ %D%/packages/patches/gcc-6-arm-none-eabi-multilib.patch \ %D%/packages/patches/gcc-6-cross-environment-variables.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-gd2-read-test.patch \ %D%/packages/patches/gd-fix-tests-on-i686.patch \ diff --git a/gnu/packages/gd.scm b/gnu/packages/gd.scm index 713f7ae91e..1c2be119b1 100644 --- a/gnu/packages/gd.scm +++ b/gnu/packages/gd.scm @@ -36,12 +36,11 @@ (define-public gd (package (name "gd") - (replacement gd-2.2.4) ;; Note: With libgd.org now pointing to github.com, genuine old ;; tarballs are no longer available. Notably, versions 2.0.x are ;; missing. - (version "2.2.3") + (version "2.2.4") (source (origin (method url-fetch) @@ -50,12 +49,21 @@ version "/libgd-" version ".tar.xz")) (sha256 (base32 - "0g3xz8jpz1pl2zzmssglrpa9nxiaa7rmcmvgpbrjz8k9cyynqsvl")) - (patches (search-patches "gd-CVE-2016-7568.patch" - "gd-CVE-2016-8670.patch" - "gd-fix-gd2-read-test.patch" + "1rp4v7n1dq38b92kl7gkvpvqqkw7nvdfnz6d5kip5klkxfki6zqk")) + (patches (search-patches "gd-fix-gd2-read-test.patch" "gd-fix-tests-on-i686.patch")))) (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 `(("pkg-config" ,pkg-config))) (inputs @@ -78,32 +86,6 @@ most common applications of GD involve website development.") "See COPYING file in the distribution.")) (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 (package (name "perl-gd") diff --git a/gnu/packages/patches/gd-CVE-2016-7568.patch b/gnu/packages/patches/gd-CVE-2016-7568.patch deleted file mode 100644 index 6a1a63296c..0000000000 --- a/gnu/packages/patches/gd-CVE-2016-7568.patch +++ /dev/null @@ -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 -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 - diff --git a/gnu/packages/patches/gd-CVE-2016-8670.patch b/gnu/packages/patches/gd-CVE-2016-8670.patch deleted file mode 100644 index 39ee99ac31..0000000000 --- a/gnu/packages/patches/gd-CVE-2016-8670.patch +++ /dev/null @@ -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" -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 . - -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 -