~ruther/guix-local

e77aef7f74caa82baf393f25a0722f444d19cc37 — Saku Laesvuori via Guix-patches via 3 years ago f405537
gnu: imagemagick: Update to 6.9.12-91.

* gnu/packages/imagemagick.scm (imagemagick)
(imagemagick/stable): Update to 6.9.12-91.
[patches]: Remove upstreamed patches. Add patch for fixing tests.
[arguments]: Enable tests.
* gnu/packages/patches/imagemagick-Fix-tests.patch: New file.
gnu/packages/patches/imagemagick-CVE-2020-27829.patch: Delete file.
* gnu/packages/patches/imagemagick-WriteTHUMBNAILImage-fix.patch: Likewise.
* gnu/packages/patches/imagemagick-ReadDCMImage-fix.patch: Likewise.
* gnu/packages/patches/imagemagick-ReadDCMPixels-fix.patch: Likewise.
* gnu/local.mk (dist_patch_DATA): Adjust accordingly.

Signed-off-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Modified-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>
Change-Id: I4c554abb1e5592590c3af8c57d9113d90de3f194
7 files changed, 36 insertions(+), 139 deletions(-)

M gnu/local.mk
M gnu/packages/imagemagick.scm
D gnu/packages/patches/imagemagick-CVE-2020-27829.patch
D gnu/packages/patches/imagemagick-ReadDCMImage-fix.patch
D gnu/packages/patches/imagemagick-ReadDCMPixels-fix.patch
D gnu/packages/patches/imagemagick-WriteTHUMBNAILImage-fix.patch
A gnu/packages/patches/imagemagick-fix-tests.patch
M gnu/local.mk => gnu/local.mk +1 -4
@@ 1535,10 1535,7 @@ dist_patch_DATA =						\
  %D%/packages/patches/idris-test-ffi008.patch			\
  %D%/packages/patches/igraph-fix-varargs-integer-size.patch	\
  %D%/packages/patches/ilmbase-fix-tests.patch			\
  %D%/packages/patches/imagemagick-CVE-2020-27829.patch		\
  %D%/packages/patches/imagemagick-ReadDCMImage-fix.patch	\
  %D%/packages/patches/imagemagick-ReadDCMPixels-fix.patch	\
  %D%/packages/patches/imagemagick-WriteTHUMBNAILImage-fix.patch	\
  %D%/packages/patches/imagemagick-fix-tests.patch		\
  %D%/packages/patches/inkscape-poppler-compat.patch		\
  %D%/packages/patches/instead-use-games-path.patch		\
  %D%/packages/patches/intltool-perl-compatibility.patch	\

M gnu/packages/imagemagick.scm => gnu/packages/imagemagick.scm +12 -22
@@ 65,19 65,16 @@
     ;; The 7 release series has an incompatible API, while the 6 series is still
     ;; maintained. Don't update to 7 until we've made sure that the ImageMagick
     ;; users are ready for the 7-series API.
     (version "6.9.12-4")
     (version "6.9.12-91")
     (source (origin
              (method url-fetch)
              (uri (string-append "mirror://imagemagick/ImageMagick-"
                                  version ".tar.xz"))
              (sha256
               (base32
                "1pkwij76yz7vd5grl6520pgpa912qb6kh34qamx4zfndwcx6cf6b"))
              (patches
               (search-patches "imagemagick-ReadDCMImage-fix.patch"
                               "imagemagick-ReadDCMPixels-fix.patch"
                               "imagemagick-WriteTHUMBNAILImage-fix.patch"
                               "imagemagick-CVE-2020-27829.patch"))))
               (method url-fetch)
               (uri (string-append "mirror://imagemagick/ImageMagick-"
                                   version ".tar.xz"))
               (sha256
                (base32
                 "0didbs10i9zb4dgripa851j7fivxb9jar7l3vvxz6i4kn6xvdv7r"))
               (patches
                (search-patches "imagemagick-fix-tests.patch"))))
     (build-system gnu-build-system)
     (arguments
      (list


@@ 85,10 82,6 @@

                                 ;; Do not embed the build date in binaries.
                                 "--enable-reproducible-build")

       ;; FIXME: The test suite succeeded before version 6.9.6-2.
       ;; Try enabling it again with newer releases.
       #:tests? #f
       #:phases
       #~(modify-phases %standard-phases
           (add-before 'build 'pre-build


@@ 153,19 146,16 @@ text, lines, polygons, ellipses and Bézier curves.")
    ;; The 7 release series has an incompatible API, while the 6 series is still
    ;; maintained. Don't update to 7 until we've made sure that the ImageMagick
    ;; users are ready for the 7-series API.
    (version "6.9.12-4")
    (version "6.9.12-91")
    (source (origin
              (method url-fetch)
              (uri (string-append "mirror://imagemagick/ImageMagick-"
                                  version ".tar.xz"))
              (sha256
               (base32
                "1pkwij76yz7vd5grl6520pgpa912qb6kh34qamx4zfndwcx6cf6b"))
                "0didbs10i9zb4dgripa851j7fivxb9jar7l3vvxz6i4kn6xvdv7r"))
              (patches
               (search-patches "imagemagick-ReadDCMImage-fix.patch"
                               "imagemagick-ReadDCMPixels-fix.patch"
                               "imagemagick-WriteTHUMBNAILImage-fix.patch"
                               "imagemagick-CVE-2020-27829.patch"))))))
               (search-patches "imagemagick-fix-tests.patch"))))))

(define-public perl-image-magick
  (package

D gnu/packages/patches/imagemagick-CVE-2020-27829.patch => gnu/packages/patches/imagemagick-CVE-2020-27829.patch +0 -27
@@ 1,27 0,0 @@
We omit the ChangeLog changes below, since they do not apply cleanly.


From 6ee5059cd3ac8d82714a1ab1321399b88539abf0 Mon Sep 17 00:00:00 2001
From: Cristy <urban-warrior@imagemagick.org>
Date: Mon, 30 Nov 2020 16:26:59 +0000
Subject: [PATCH] possible TIFF related-heap buffer overflow (alert & POC by
 Hardik Shah)

---
 ChangeLog     | 6 ++++++
 coders/tiff.c | 2 +-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/coders/tiff.c b/coders/tiff.c
index e98f927ab..1eecf17ae 100644
--- a/coders/tiff.c
+++ b/coders/tiff.c
@@ -1975,7 +1975,7 @@ static Image *ReadTIFFImage(const ImageInfo *image_info,
         extent+=image->columns*sizeof(uint32);
 #endif
         strip_pixels=(unsigned char *) AcquireQuantumMemory(extent,
-          sizeof(*strip_pixels));
+          2*sizeof(*strip_pixels));
         if (strip_pixels == (unsigned char *) NULL)
           ThrowTIFFException(ResourceLimitError,"MemoryAllocationFailed");
         (void) memset(strip_pixels,0,extent*sizeof(*strip_pixels));

D gnu/packages/patches/imagemagick-ReadDCMImage-fix.patch => gnu/packages/patches/imagemagick-ReadDCMImage-fix.patch +0 -26
@@ 1,26 0,0 @@
From 512668dfd92b20d0d08b91d62b422d8262573281 Mon Sep 17 00:00:00 2001
From: Dirk Lemstra <dirk@lemstra.org>
Date: Wed, 24 Mar 2021 20:37:15 +0100
Subject: [PATCH] Throw exception when no exception was raised but status was
 false (#3432).

---
 coders/dcm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/coders/dcm.c b/coders/dcm.c
index 7a68ed6e8..ed17c9567 100644
--- a/coders/dcm.c
+++ b/coders/dcm.c
@@ -3989,6 +3989,8 @@ static Image *ReadDCMImage(const ImageInfo *image_info,ExceptionInfo *exception)
         if (redmap != (int *) NULL)
           redmap=(int *) RelinquishMagickMemory(redmap);
         image=DestroyImageList(image);
+        if ((status == MagickFalse) && (exception->severity < ErrorException))
+          ThrowReaderException(CorruptImageError,"CorruptImage");
         return(GetFirstImageInList(images));
       }
     if (info.depth != (1UL*MAGICKCORE_QUANTUM_DEPTH))
-- 
2.31.0


D gnu/packages/patches/imagemagick-ReadDCMPixels-fix.patch => gnu/packages/patches/imagemagick-ReadDCMPixels-fix.patch +0 -35
@@ 1,35 0,0 @@
From c8f25953ad1dd38a8b2d92738f0f742ad7e0bce7 Mon Sep 17 00:00:00 2001
From: Cristy <mikayla-grace@urban-warrior.org>
Date: Sun, 21 Mar 2021 21:21:15 -0400
Subject: [PATCH] https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=32322

---
 coders/dcm.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/coders/dcm.c b/coders/dcm.c
index 29eed9618..7a68ed6e8 100644
--- a/coders/dcm.c
+++ b/coders/dcm.c
@@ -2984,12 +2984,12 @@ static MagickBooleanType ReadDCMPixels(Image *image,DCMInfo *info,
         }
       else
         {
-          SetPixelRed(q,(Quantum) (((ssize_t) pixel.red) |
-            (((ssize_t) GetPixelRed(q)) << 8)));
-          SetPixelGreen(q,(Quantum) (((ssize_t) pixel.green) |
-            (((ssize_t) GetPixelGreen(q)) << 8)));
-          SetPixelBlue(q,(Quantum) (((ssize_t) pixel.blue) |
-            (((ssize_t) GetPixelBlue(q)) << 8)));
+          SetPixelRed(q,(Quantum) (((size_t) pixel.red) |
+            (((size_t) GetPixelRed(q)) << 8)));
+          SetPixelGreen(q,(Quantum) (((size_t) pixel.green) |
+            (((size_t) GetPixelGreen(q)) << 8)));
+          SetPixelBlue(q,(Quantum) (((size_t) pixel.blue) |
+            (((size_t) GetPixelBlue(q)) << 8)));
         }
       q++;
     }
-- 
2.31.0


D gnu/packages/patches/imagemagick-WriteTHUMBNAILImage-fix.patch => gnu/packages/patches/imagemagick-WriteTHUMBNAILImage-fix.patch +0 -25
@@ 1,25 0,0 @@
From 6a5d3575487487f2703383338bd17c8c25068f19 Mon Sep 17 00:00:00 2001
From: Cristy <mikayla-grace@urban-warrior.org>
Date: Thu, 25 Mar 2021 08:58:18 -0400
Subject: [PATCH] eliminate compiler warning

---
 coders/thumbnail.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/coders/thumbnail.c b/coders/thumbnail.c
index 3833341b0..1e2bfe8c2 100644
--- a/coders/thumbnail.c
+++ b/coders/thumbnail.c
@@ -199,7 +199,7 @@ static MagickBooleanType WriteTHUMBNAILImage(const ImageInfo *image_info,
     q++;
   }
   if ((q > (GetStringInfoDatum(profile)+GetStringInfoLength(profile))) ||
-      (length > (GetStringInfoDatum(profile)+GetStringInfoLength(profile)-q)))
+      ((ssize_t) length > (GetStringInfoDatum(profile)+GetStringInfoLength(profile)-q)))
     ThrowWriterException(CoderError,"ImageDoesNotHaveAThumbnail");
   thumbnail_image=BlobToImage(image_info,q,length,&image->exception);
   if (thumbnail_image == (Image *) NULL)
-- 
2.31.0


A gnu/packages/patches/imagemagick-fix-tests.patch => gnu/packages/patches/imagemagick-fix-tests.patch +23 -0
@@ 0,0 1,23 @@
From 696d8735e05688d0162b769f37b0d75205ab2a97 Mon Sep 17 00:00:00 2001
From: Saku Laesvuori <saku@laesvuori.fi>
Date: Thu, 20 Jul 2023 19:14:43 +0300
Subject: [PATCH] Fix tests

---
 Magick++/demo/demo.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Magick++/demo/demo.cpp b/Magick++/demo/demo.cpp
index 14721dbcd..12cc3b10c 100644
--- a/Magick++/demo/demo.cpp
+++ b/Magick++/demo/demo.cpp
@@ -477,7 +477,7 @@ int main( int /*argc*/, char ** argv)
       montageOpts.compose( OverCompositeOp );
       montageOpts.backgroundColor( "#ffffff" );
       montageOpts.pointSize( 18 );
+      montageOpts.font(MAGICK_FONT);
       montageOpts.fillColor( "#600" );
       montageOpts.strokeColor( Color() );
       montageOpts.compose(OverCompositeOp);
--
2.41.0