From 114a325e8f86c820484c9f64fde6bbadca41eed4 Mon Sep 17 00:00:00 2001 From: ng0 Date: Tue, 10 Jan 2017 20:49:30 +0000 Subject: gnu: Add libpng-apng. * gnu/packages/image.scm (libpng-apng): New variable. Co-authored-by: Kei Kebreau --- gnu/packages/image.scm | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) (limited to 'gnu/packages/image.scm') diff --git a/gnu/packages/image.scm b/gnu/packages/image.scm index 53ed69a84e..f348a61c9b 100644 --- a/gnu/packages/image.scm +++ b/gnu/packages/image.scm @@ -14,6 +14,7 @@ ;;; Copyright © 2016 Eric Bavier ;;; Copyright © 2016 Arun Isaac ;;; Copyright © 2016 Kei Kebreau +;;; Copyright © 2017 ng0 ;;; ;;; This file is part of GNU Guix. ;;; @@ -98,6 +99,57 @@ library. It supports almost all PNG features and is extensible.") (inherit (package-source libpng)) (patches (search-patches "libpng-CVE-2016-10087.patch")))))) +(define-public libpng-apng + (package + (inherit libpng) + (replacement #f) ;libpng's replacement doesn't apply here + (name "libpng-apng") + (version (package-version libpng)) + (source + (origin + (inherit (package-source libpng)) + (patches (search-patches "libpng-CVE-2016-10087.patch")))) + (arguments + `(#:phases + (modify-phases %standard-phases + (add-after 'unpack 'patch-apng + (lambda* (#:key inputs #:allow-other-keys) + (define (apply-patch file) + (zero? (system* "patch" "-p1" "--force" + "--input" file))) + (let ((apng.gz (assoc-ref inputs "apng"))) + (format #t "Applying APNG patch '~a'...~%" + apng.gz) + (system (string-append "gunzip < " apng.gz " > the-patch")) + (and (apply-patch "the-patch") + (for-each apply-patch + (find-files "\\.patch")))) + #t)) + (add-before 'configure 'no-checks + (lambda _ + (substitute* "Makefile.in" + (("^scripts/symbols.chk") "") + (("check: scripts/symbols.chk") "")) + (zero? (system* "libtool")) + #t))))) + (inputs + `(("apng" ,(origin + (method url-fetch) + (uri + (string-append "mirror://sourceforge/libpng-apng/libpng16/" + version "/libpng-" version "-apng.patch.gz")) + (sha256 + (base32 + "026r0gbkf6d6v54wca02cdxln8sj4m2c1yk62sj2aasv2ki2ffh5")))))) + (native-inputs + `(("libtool" ,libtool))) + (synopsis "APNG patch for libpng") + (description + "APNG (Animated Portable Network Graphics) is an unofficial +extension of the APNG (Portable Network Graphics) format. +APNG patch provides APNG support to libpng.") + (home-page "https://sourceforge.net/projects/libpng-apng/"))) + (define-public libpng-1.2 (package (inherit libpng) -- cgit v1.2.3 From 8f9858161310ef19ff5c65c9dcce2bbd9f58d25a Mon Sep 17 00:00:00 2001 From: Kei Kebreau Date: Fri, 17 Mar 2017 11:33:04 -0400 Subject: gnu: libpng-apng: Remove unnecessary call to libtool. * gnu/packages/image.scm (libpng-apng)[phases]: Remove it. --- gnu/packages/image.scm | 1 - 1 file changed, 1 deletion(-) (limited to 'gnu/packages/image.scm') diff --git a/gnu/packages/image.scm b/gnu/packages/image.scm index f348a61c9b..9b8a3a63da 100644 --- a/gnu/packages/image.scm +++ b/gnu/packages/image.scm @@ -130,7 +130,6 @@ library. It supports almost all PNG features and is extensible.") (substitute* "Makefile.in" (("^scripts/symbols.chk") "") (("check: scripts/symbols.chk") "")) - (zero? (system* "libtool")) #t))))) (inputs `(("apng" ,(origin -- cgit v1.2.3 From 2a047d59e03100b1cafb8cc235cab75e7e6415c7 Mon Sep 17 00:00:00 2001 From: Marius Bakke Date: Fri, 17 Mar 2017 20:10:12 +0100 Subject: gnu: libwebp: Update to 0.6.0. * gnu/packages/image.scm (libwebp): Update to 0.6.0. [source]: Remove patch. * gnu/packages/patches/libwebp-CVE-2016-9085.patch: Delete file. * gnu/local.mk (dist_patch_DATA): Remove it. --- gnu/local.mk | 1 - gnu/packages/image.scm | 5 +- gnu/packages/patches/libwebp-CVE-2016-9085.patch | 144 ----------------------- 3 files changed, 2 insertions(+), 148 deletions(-) delete mode 100644 gnu/packages/patches/libwebp-CVE-2016-9085.patch (limited to 'gnu/packages/image.scm') diff --git a/gnu/local.mk b/gnu/local.mk index f2ce6c0a63..48c134ba6e 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -714,7 +714,6 @@ dist_patch_DATA = \ %D%/packages/patches/libtool-skip-tests2.patch \ %D%/packages/patches/libunwind-CVE-2015-3239.patch \ %D%/packages/patches/libvpx-CVE-2016-2818.patch \ - %D%/packages/patches/libwebp-CVE-2016-9085.patch \ %D%/packages/patches/libwmf-CAN-2004-0941.patch \ %D%/packages/patches/libwmf-CVE-2006-3376.patch \ %D%/packages/patches/libwmf-CVE-2007-0455.patch \ diff --git a/gnu/packages/image.scm b/gnu/packages/image.scm index 9b8a3a63da..f2afa988cb 100644 --- a/gnu/packages/image.scm +++ b/gnu/packages/image.scm @@ -805,17 +805,16 @@ multi-dimensional image processing.") (define-public libwebp (package (name "libwebp") - (version "0.5.1") + (version "0.6.0") (source (origin (method url-fetch) (uri (string-append "http://downloads.webmproject.org/releases/webp/libwebp-" version ".tar.gz")) - (patches (search-patches "libwebp-CVE-2016-9085.patch")) (sha256 (base32 - "1pqki1g8nzi8qgciysypd5r38zccv81np1dn43g27830rmpnrmka")))) + "0h1brwkyxc7lb8lc53aacdks5vc1y9hzngqi41gg7y6l56912a69")))) (build-system gnu-build-system) (inputs `(("freeglut" ,freeglut) diff --git a/gnu/packages/patches/libwebp-CVE-2016-9085.patch b/gnu/packages/patches/libwebp-CVE-2016-9085.patch deleted file mode 100644 index e40b353303..0000000000 --- a/gnu/packages/patches/libwebp-CVE-2016-9085.patch +++ /dev/null @@ -1,144 +0,0 @@ -Fix CVE-2016-9085 (several integer overflows): - -https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-9085 -http://seclists.org/oss-sec/2016/q4/253 - -Patch copied from upstream source repository: - -https://chromium.googlesource.com/webm/libwebp/+/e2affacc35f1df6cc3b1a9fa0ceff5ce2d0cce83 - -From e2affacc35f1df6cc3b1a9fa0ceff5ce2d0cce83 Mon Sep 17 00:00:00 2001 -From: Pascal Massimino -Date: Mon, 10 Oct 2016 11:48:39 +0200 -Subject: [PATCH] fix potential overflow when width * height * 4 >= (1<<32) - -Mostly: avoid doing calculation like: ptr + j * stride -when stride is 'int'. Rather use size_t, or pointer increments (ptr += stride) -when possible. - -BUG=webp:314 - -Change-Id: I81c684b515dd1ec4f601f32d50a6e821c4e46e20 ---- - examples/gifdec.c | 56 +++++++++++++++++++++++++++++++------------------------ - 1 file changed, 32 insertions(+), 24 deletions(-) - -diff --git a/examples/gifdec.c b/examples/gifdec.c -index 83c3d82..7df176f 100644 ---- a/examples/gifdec.c -+++ b/examples/gifdec.c -@@ -20,6 +20,7 @@ - - #include "webp/encode.h" - #include "webp/mux_types.h" -+#include "webp/format_constants.h" - - #define GIF_TRANSPARENT_COLOR 0x00000000 - #define GIF_WHITE_COLOR 0xffffffff -@@ -103,12 +104,19 @@ int GIFReadFrame(GifFileType* const gif, int transparent_index, - const GifImageDesc* const image_desc = &gif->Image; - uint32_t* dst = NULL; - uint8_t* tmp = NULL; -- int ok = 0; -- GIFFrameRect rect = { -+ const GIFFrameRect rect = { - image_desc->Left, image_desc->Top, image_desc->Width, image_desc->Height - }; -+ const uint64_t memory_needed = 4 * rect.width * (uint64_t)rect.height; -+ int ok = 0; - *gif_rect = rect; - -+ if (memory_needed != (size_t)memory_needed || -+ memory_needed > 4 * MAX_IMAGE_AREA) { -+ fprintf(stderr, "Image is too large (%d x %d).", rect.width, rect.height); -+ return 0; -+ } -+ - // Use a view for the sub-picture: - if (!WebPPictureView(picture, rect.x_offset, rect.y_offset, - rect.width, rect.height, &sub_image)) { -@@ -132,15 +140,15 @@ int GIFReadFrame(GifFileType* const gif, int transparent_index, - y += interlace_jumps[pass]) { - if (DGifGetLine(gif, tmp, rect.width) == GIF_ERROR) goto End; - Remap(gif, tmp, rect.width, transparent_index, -- dst + y * sub_image.argb_stride); -+ dst + y * (size_t)sub_image.argb_stride); - } - } - } else { // Non-interlaced image. - int y; -- for (y = 0; y < rect.height; ++y) { -+ uint32_t* ptr = dst; -+ for (y = 0; y < rect.height; ++y, ptr += sub_image.argb_stride) { - if (DGifGetLine(gif, tmp, rect.width) == GIF_ERROR) goto End; -- Remap(gif, tmp, rect.width, transparent_index, -- dst + y * sub_image.argb_stride); -+ Remap(gif, tmp, rect.width, transparent_index, ptr); - } - } - ok = 1; -@@ -216,13 +224,11 @@ int GIFReadMetadata(GifFileType* const gif, GifByteType** const buf, - - static void ClearRectangle(WebPPicture* const picture, - int left, int top, int width, int height) { -- int j; -- for (j = top; j < top + height; ++j) { -- uint32_t* const dst = picture->argb + j * picture->argb_stride; -- int i; -- for (i = left; i < left + width; ++i) { -- dst[i] = GIF_TRANSPARENT_COLOR; -- } -+ int i, j; -+ const size_t stride = picture->argb_stride; -+ uint32_t* dst = picture->argb + top * stride + left; -+ for (j = 0; j < height; ++j, dst += stride) { -+ for (i = 0; i < width; ++i) dst[i] = GIF_TRANSPARENT_COLOR; - } - } - -@@ -246,29 +252,31 @@ void GIFDisposeFrame(GIFDisposeMethod dispose, const GIFFrameRect* const rect, - if (dispose == GIF_DISPOSE_BACKGROUND) { - GIFClearPic(curr_canvas, rect); - } else if (dispose == GIF_DISPOSE_RESTORE_PREVIOUS) { -- const int src_stride = prev_canvas->argb_stride; -- const uint32_t* const src = -- prev_canvas->argb + rect->x_offset + rect->y_offset * src_stride; -- const int dst_stride = curr_canvas->argb_stride; -- uint32_t* const dst = -- curr_canvas->argb + rect->x_offset + rect->y_offset * dst_stride; -+ const size_t src_stride = prev_canvas->argb_stride; -+ const uint32_t* const src = prev_canvas->argb + rect->x_offset -+ + rect->y_offset * src_stride; -+ const size_t dst_stride = curr_canvas->argb_stride; -+ uint32_t* const dst = curr_canvas->argb + rect->x_offset -+ + rect->y_offset * dst_stride; - assert(prev_canvas != NULL); -- WebPCopyPlane((uint8_t*)src, 4 * src_stride, (uint8_t*)dst, 4 * dst_stride, -+ WebPCopyPlane((uint8_t*)src, (int)(4 * src_stride), -+ (uint8_t*)dst, (int)(4 * dst_stride), - 4 * rect->width, rect->height); - } - } - - void GIFBlendFrames(const WebPPicture* const src, - const GIFFrameRect* const rect, WebPPicture* const dst) { -- int j; -+ int i, j; -+ const size_t src_stride = src->argb_stride; -+ const size_t dst_stride = dst->argb_stride; - assert(src->width == dst->width && src->height == dst->height); - for (j = rect->y_offset; j < rect->y_offset + rect->height; ++j) { -- int i; - for (i = rect->x_offset; i < rect->x_offset + rect->width; ++i) { -- const uint32_t src_pixel = src->argb[j * src->argb_stride + i]; -+ const uint32_t src_pixel = src->argb[j * src_stride + i]; - const int src_alpha = src_pixel >> 24; - if (src_alpha != 0) { -- dst->argb[j * dst->argb_stride + i] = src_pixel; -+ dst->argb[j * dst_stride + i] = src_pixel; - } - } - } --- -2.10.1 - -- cgit v1.2.3 From 21122bd79e7f9b0b5349ffffe2c146bace7205dc Mon Sep 17 00:00:00 2001 From: John Darrington Date: Tue, 7 Mar 2017 07:59:21 +0100 Subject: gnu: Add niftilib. * gnu/packages/image.scm (niftilib): New variable. --- gnu/packages/image.scm | 59 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) (limited to 'gnu/packages/image.scm') diff --git a/gnu/packages/image.scm b/gnu/packages/image.scm index f2afa988cb..73c5298e17 100644 --- a/gnu/packages/image.scm +++ b/gnu/packages/image.scm @@ -6,7 +6,7 @@ ;;; Copyright © 2014, 2016 Ricardo Wurmus ;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer ;;; Copyright © 2015 Amirouche Boubekki -;;; Copyright © 2014 John Darrington +;;; Copyright © 2014, 2017 John Darrington ;;; Copyright © 2016 Leo Famulari ;;; Copyright © 2016, 2017 Leo Famulari ;;; Copyright © 2016, 2017 Efraim Flashner @@ -1164,3 +1164,60 @@ interface. It supports color space extensions that allow it to compress from and decompress to 32-bit and big-endian pixel buffers (RGBX, XBGR, etc.).") (license (list license:bsd-3 ; jsimd*.[ch] and most of simd/ license:ijg)))) ; the rest + +(define-public niftilib + (package + (name "niftilib") + (version "2.0.0") + (source (origin + (method url-fetch) + (uri (list (string-append "mirror://sourceforge/niftilib/" + "nifticlib/nifticlib_" + (string-join (string-split version #\.) "_") + "/nifticlib-" version ".tar.gz"))) + (sha256 + (base32 "123z9bwzgin5y8gi5ni8j217k7n683whjsvg0lrpii9flgk8isd3")))) + (build-system gnu-build-system) + (arguments + '(#:tests? #f + #:parallel-build? #f + #:phases + (modify-phases %standard-phases + (replace 'install + (lambda _ + (for-each + (lambda (dir) + (let ((directory (assoc-ref %outputs "out"))) + (mkdir-p (string-append directory "/" dir)) + (zero? (system* "cp" "-a" dir directory)))) + '("bin" "lib" "include")))) + (replace 'configure + (lambda _ + (substitute* "Makefile" + (("^SHELL[ \t]*=[ \t]*csh") + (string-append "SHELL = " + (assoc-ref %build-inputs "bash") + "/bin/sh")) + + (("^CFLAGS[ \t]*=[ \t]\\$\\(ANSI_FLAGS\\)") + "CFLAGS = $(ANSI_FLAGS) -fPIC") + + (("^ZLIB_INC[ \t]*=[ \t]*-I/usr/include") + (string-append "ZLIB_INC = -I" + (assoc-ref %build-inputs "zlib") + "/include")) + + (("^CP[ \t]*=[ \t]*cp") + (string-append "CP = " + (assoc-ref %build-inputs "coreutils") + "/bin/cp"))) + #t))))) + (inputs + `(("zlib" ,zlib))) + (synopsis "Library for reading and writing files in the nifti-1 format") + (description "Niftilib is a set of i/o libraries for reading and writing +files in the nifti-1 data format - a binary file format for storing +medical image data, e.g. magnetic resonance image (MRI) and functional MRI +(fMRI) brain images.") + (home-page "http://niftilib.sourceforge.net") + (license license:public-domain))) -- cgit v1.2.3 From f729a4d8b274aebd578f45b2ca55cded31001b85 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Sun, 19 Mar 2017 14:24:27 +0100 Subject: gnu: niftilib: Simplify build phases. * gnu/packages/image.scm (niftilib)[arguments]: Use make-flags instead of replacing "configure" phase; simplify "install" phase. --- gnu/packages/image.scm | 91 ++++++++++++++++++++++---------------------------- 1 file changed, 39 insertions(+), 52 deletions(-) (limited to 'gnu/packages/image.scm') diff --git a/gnu/packages/image.scm b/gnu/packages/image.scm index 73c5298e17..2c438a8dd0 100644 --- a/gnu/packages/image.scm +++ b/gnu/packages/image.scm @@ -3,7 +3,7 @@ ;;; Copyright © 2013, 2015, 2016 Andreas Enge ;;; Copyright © 2014, 2015, 2016 Mark H Weaver ;;; Copyright © 2014, 2015 Alex Kost -;;; Copyright © 2014, 2016 Ricardo Wurmus +;;; Copyright © 2014, 2016, 2017 Ricardo Wurmus ;;; Copyright © 2015 Taylan Ulrich Bayırlı/Kammer ;;; Copyright © 2015 Amirouche Boubekki ;;; Copyright © 2014, 2017 John Darrington @@ -1167,57 +1167,44 @@ and decompress to 32-bit and big-endian pixel buffers (RGBX, XBGR, etc.).") (define-public niftilib (package - (name "niftilib") - (version "2.0.0") - (source (origin - (method url-fetch) - (uri (list (string-append "mirror://sourceforge/niftilib/" - "nifticlib/nifticlib_" - (string-join (string-split version #\.) "_") - "/nifticlib-" version ".tar.gz"))) - (sha256 - (base32 "123z9bwzgin5y8gi5ni8j217k7n683whjsvg0lrpii9flgk8isd3")))) - (build-system gnu-build-system) - (arguments - '(#:tests? #f - #:parallel-build? #f - #:phases - (modify-phases %standard-phases - (replace 'install - (lambda _ - (for-each - (lambda (dir) - (let ((directory (assoc-ref %outputs "out"))) - (mkdir-p (string-append directory "/" dir)) - (zero? (system* "cp" "-a" dir directory)))) - '("bin" "lib" "include")))) - (replace 'configure - (lambda _ - (substitute* "Makefile" - (("^SHELL[ \t]*=[ \t]*csh") - (string-append "SHELL = " - (assoc-ref %build-inputs "bash") - "/bin/sh")) - - (("^CFLAGS[ \t]*=[ \t]\\$\\(ANSI_FLAGS\\)") - "CFLAGS = $(ANSI_FLAGS) -fPIC") - - (("^ZLIB_INC[ \t]*=[ \t]*-I/usr/include") - (string-append "ZLIB_INC = -I" - (assoc-ref %build-inputs "zlib") - "/include")) - - (("^CP[ \t]*=[ \t]*cp") - (string-append "CP = " - (assoc-ref %build-inputs "coreutils") - "/bin/cp"))) - #t))))) - (inputs - `(("zlib" ,zlib))) - (synopsis "Library for reading and writing files in the nifti-1 format") - (description "Niftilib is a set of i/o libraries for reading and writing + (name "niftilib") + (version "2.0.0") + (source (origin + (method url-fetch) + (uri (list (string-append "mirror://sourceforge/niftilib/" + "nifticlib/nifticlib_" + (string-join (string-split version #\.) "_") + "/nifticlib-" version ".tar.gz"))) + (sha256 + (base32 "123z9bwzgin5y8gi5ni8j217k7n683whjsvg0lrpii9flgk8isd3")))) + (build-system gnu-build-system) + (arguments + '(#:tests? #f ; there is no test target + #:parallel-build? #f ; not supported + #:make-flags + (list "SHELL=bash" + (string-append "ZLIB_INC=" + (assoc-ref %build-inputs "zlib") "/include") + ;; Append "-fPIC" to CFLAGS. + (string-append "CFLAGS=" + "-Wall -ansi -pedantic -fPIC")) + #:phases + (modify-phases %standard-phases + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let ((out (assoc-ref outputs "out"))) + (for-each + (lambda (dir) + (copy-recursively dir (string-append out "/" dir))) + '("bin" "lib" "include"))) + #t)) + (delete 'configure)))) + (inputs + `(("zlib" ,zlib))) + (synopsis "Library for reading and writing files in the nifti-1 format") + (description "Niftilib is a set of i/o libraries for reading and writing files in the nifti-1 data format - a binary file format for storing medical image data, e.g. magnetic resonance image (MRI) and functional MRI (fMRI) brain images.") - (home-page "http://niftilib.sourceforge.net") - (license license:public-domain))) + (home-page "http://niftilib.sourceforge.net") + (license license:public-domain))) -- cgit v1.2.3