Skip to contentSkip to conversation

imagemagick: patch CVE-2026-24481

PATCH In review Gyorgy Sarvari 1 participant 12 messages Mar 6

lore
Share & tools
lore
#0 lore raw

PATCH 1/11 imagemagick: patch CVE-2026-24481

Details: https://nvd.nist.gov/vuln/detail/CVE-2026-24481

Backport the patch that references the related Github advisory[1] in its description explicitly.

[1]: https://github.com/ImageMagick/ImageMagick/security/advisories/GHSA-96pc-27rx-pr36

---
 .../imagemagick/CVE-2026-24481.patch          | 25 +++++++++++++++++++
 .../imagemagick/imagemagick_7.1.2-13.bb       |  3 ++-
 2 files changed, 27 insertions(+), 1 deletion(-)
 create mode 100644 meta-oe/recipes-support/imagemagick/imagemagick/CVE-2026-24481.patch
meta-oe/recipes-support/imagemagick/imagemagick/CVE-2026-24481.patch new file +25 -0
new file mode 100644
index 0000000000..3d35a3f1d6
@@ -0,0 +1,25 @@
+From 6778a890f95971c61a16593abc2cd15376d22cdd Mon Sep 17 00:00:00 2001
+From: Dirk Lemstra <[email protected]>
+Date: Fri, 23 Jan 2026 13:19:06 +0100
+Subject: [PATCH] Initialize the pixels with empty values to prevent possible
+ heap information disclosure (GHSA-96pc-27rx-pr36)
+
+CVE: CVE-2026-24481
+Upstream-Status: Backport [https://github.com/ImageMagick/ImageMagick/commit/51c9d33f4770cdcfa1a029199375d570af801c97]
+Signed-off-by: Gyorgy Sarvari <[email protected]>
+---
+ coders/psd.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/coders/psd.c b/coders/psd.c
+index 28495c6d5..bb4ceecd6 100644
+--- a/coders/psd.c
++++ b/coders/psd.c
+@@ -1334,6 +1334,7 @@ static MagickBooleanType ReadPSDChannelZip(Image *image,
+       ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
+         image->filename);
+     }
++  memset(pixels,0,count*sizeof(*pixels));
+   if (ReadBlob(image,compact_size,compact_pixels) != (ssize_t) compact_size)
+     {
+       pixels=(unsigned char *) RelinquishMagickMemory(pixels);
meta-oe/recipes-support/imagemagick/imagemagick_7.1.2-13.bb +2 -1
index e3f4a96d6f..adf65880b6 100644
@@ -15,7 +15,8 @@ UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>([0-9][\.|_|-]?)+)"
 SRC_URI = "git://github.com/ImageMagick/ImageMagick.git;branch=main;protocol=https;tag=${PV} \
            file://run-ptest \
            file://imagemagick-ptest.sh \
-"
+           file://CVE-2026-24481.patch \
+           "
 
 SRCREV = "dd991e286b96918917a3392d6dc3ffc0e6907a4e"
 
#1 lore raw

PATCH 2/11 imagemagick: patch CVE-2026-24484

Details: https://nvd.nist.gov/vuln/detail/CVE-2026-24484

Backport the commit referenced by the NVD advisory.

---
 .../imagemagick/CVE-2026-24484.patch          | 27 +++++++++++++++++++
 .../imagemagick/imagemagick_7.1.2-13.bb       |  1 +
 2 files changed, 28 insertions(+)
 create mode 100644 meta-oe/recipes-support/imagemagick/imagemagick/CVE-2026-24484.patch
meta-oe/recipes-support/imagemagick/imagemagick/CVE-2026-24484.patch new file +27 -0
new file mode 100644
index 0000000000..b3e094f7c2
@@ -0,0 +1,27 @@
+From fd210bafa27b174f3054e7ec6da4c8cadbd75565 Mon Sep 17 00:00:00 2001
+From: Cristy <[email protected]>
+Date: Fri, 23 Jan 2026 20:27:02 -0500
+Subject: [PATCH] 
+ https://github.com/ImageMagick/ImageMagick/security/advisories/GHSA-wg3g-gvx5-2pmv
+
+CVE: CVE-2026-24484
+Upstream-Status: Backport [https://github.com/ImageMagick/ImageMagick/commit/0349df6d43d633bd61bb582d1e1e87d6332de32a]
+Signed-off-by: Gyorgy Sarvari <[email protected]>
+---
+ coders/svg.c | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/coders/svg.c b/coders/svg.c
+index f18f86460..2f8a27ebc 100644
+--- a/coders/svg.c
++++ b/coders/svg.c
+@@ -4235,6 +4235,9 @@ static MagickBooleanType WriteSVGImage(const ImageInfo *image_info,Image *image,
+             if (LocaleCompare("graphic-context",token) == 0)
+               {
+                 n++;
++                if (n == MagickMaxRecursionDepth)
++                  ThrowWriterException(DrawError,
++                    "VectorGraphicsNestedTooDeeply");
+                 if (active)
+                   {
+                     AffineToTransform(image,&affine);
meta-oe/recipes-support/imagemagick/imagemagick_7.1.2-13.bb +1 -0
index adf65880b6..991b2e363d 100644
@@ -16,6 +16,7 @@ SRC_URI = "git://github.com/ImageMagick/ImageMagick.git;branch=main;protocol=htt
            file://run-ptest \
            file://imagemagick-ptest.sh \
            file://CVE-2026-24481.patch \
+           file://CVE-2026-24484.patch \
            "
 
 SRCREV = "dd991e286b96918917a3392d6dc3ffc0e6907a4e"
#2 lore raw

PATCH 3/11 imagemagick: patch CVE-2026-24485

In reply to Gyorgy Sarvari

Details: https://nvd.nist.gov/vuln/detail/CVE-2026-24485

Backport the patch that is referenced by the NVD advisory.

Note that the backport is much shorter than the upstream version, only the macro change from the top was backported.

There are two reasons for this:
1. The omitted part fails to apply to this version.
2. The omitted part also doesn't introduce any changes. In one part it only shuffles around variable names: it consolidates variable declarations to avoid duplication, without any logic change, and in the other part it introduces a new dedicated "extent" variable to store memory size (instead of "size" variable), but that is also just cosmetics, and introduces no change in the code.

The actual fix is in the macro change, which is in this patch.

---
 .../imagemagick/CVE-2026-24485.patch          | 45 +++++++++++++++++++
 .../imagemagick/imagemagick_7.1.2-13.bb       |  1 +
 2 files changed, 46 insertions(+)
 create mode 100644 meta-oe/recipes-support/imagemagick/imagemagick/CVE-2026-24485.patch
meta-oe/recipes-support/imagemagick/imagemagick/CVE-2026-24485.patch new file +45 -0
new file mode 100644
index 0000000000..7196aaeb4d
@@ -0,0 +1,45 @@
+From 8b1f339454f9896e518f4c20482e150a9eefb304 Mon Sep 17 00:00:00 2001
+From: Cristy <[email protected]>
+Date: Thu, 22 Jan 2026 19:25:35 -0500
+Subject: [PATCH] 
+ https://github.com/ImageMagick/ImageMagick/security/advisories/GHSA-pqgj-2p96-rx85
+
+CVE: CVE-2026-24485
+Upstream-Status: Backport [https://github.com/ImageMagick/ImageMagick/commit/332c1566acc2de77857032d3c2504ead6210ff50]
+Signed-off-by: Gyorgy Sarvari <[email protected]>
+---
+ coders/pcd.c | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/coders/pcd.c b/coders/pcd.c
+index db613504f..9477c75c0 100644
+--- a/coders/pcd.c
++++ b/coders/pcd.c
+@@ -116,19 +116,26 @@ static MagickBooleanType DecodeImage(Image *image,unsigned char *luma,
+ #define IsSync(sum)  ((sum & 0xffffff00UL) == 0xfffffe00UL)
+ #define PCDGetBits(n) \
+ {  \
++  ssize_t \
++    byte_count = 0x800; \
++  \
+   sum=(sum << n) & 0xffffffff; \
+   bits-=n; \
+   while (bits <= 24) \
+   { \
+     if (p >= (buffer+0x800)) \
+       { \
+-        (void) ReadBlob(image,0x800,buffer); \
++        byte_count=ReadBlob(image,0x800,buffer); \
++        if (byte_count != 0x800) \
++          break; \
+         p=buffer; \
+       } \
+     sum|=(((unsigned int) (*p)) << (24-bits)); \
+     bits+=8; \
+     p++; \
+   } \
++  if (byte_count != 0x800) \
++    break; \
+ }
+ 
+   typedef struct PCDTable
meta-oe/recipes-support/imagemagick/imagemagick_7.1.2-13.bb +1 -0
index 991b2e363d..3e2d3ab344 100644
@@ -17,6 +17,7 @@ SRC_URI = "git://github.com/ImageMagick/ImageMagick.git;branch=main;protocol=htt
            file://imagemagick-ptest.sh \
            file://CVE-2026-24481.patch \
            file://CVE-2026-24484.patch \
+           file://CVE-2026-24485.patch \
            "
 
 SRCREV = "dd991e286b96918917a3392d6dc3ffc0e6907a4e"
#3 lore raw

PATCH 4/11 imagemagick: patch CVE-2026-25576

In reply to Gyorgy Sarvari

Details: https://nvd.nist.gov/vuln/detail/CVE-2026-25576

Backport the patch that is referenced by he NVD advisory.

---
 .../imagemagick/CVE-2026-25576.patch          | 604 ++++++++++++++++++
 .../imagemagick/imagemagick_7.1.2-13.bb       |   1 +
 2 files changed, 605 insertions(+)
 create mode 100644 meta-oe/recipes-support/imagemagick/imagemagick/CVE-2026-25576.patch
meta-oe/recipes-support/imagemagick/imagemagick/CVE-2026-25576.patch new file +604 -0
new file mode 100644
index 0000000000..87003f503e
@@ -0,0 +1,604 @@
+From 5b9798eeef019d2f9c6f120fbc173ffd872a7cf7 Mon Sep 17 00:00:00 2001
+From: Dirk Lemstra <[email protected]>
+Date: Sun, 25 Jan 2026 19:21:20 +0100
+Subject: [PATCH] Fixed out of bounds read in multiple coders that read raw
+ pixel data (GHSA-jv4p-gjwq-9r2j)
+
+CVE: CVE-2026-25576
+Upstream-Status: Backport [https://github.com/ImageMagick/ImageMagick/commit/077b42643212d7da8c1a4f6b2cd0067ebca8ec0f]
+Signed-off-by: Gyorgy Sarvari <[email protected]>
+---
+ coders/bgr.c   | 22 ++++++++++++----------
+ coders/cmyk.c  | 26 ++++++++++++++------------
+ coders/gray.c  | 14 ++++++++------
+ coders/raw.c   |  4 +++-
+ coders/rgb.c   | 26 +++++++++++++++-----------
+ coders/ycbcr.c | 22 ++++++++++++----------
+ 6 files changed, 64 insertions(+), 50 deletions(-)
+
+diff --git a/coders/bgr.c b/coders/bgr.c
+index 822653543..4b4939054 100644
+--- a/coders/bgr.c
++++ b/coders/bgr.c
+@@ -125,6 +125,7 @@ static Image *ReadBGRImage(const ImageInfo *image_info,ExceptionInfo *exception)
+     length;
+ 
+   ssize_t
++    columns,
+     count,
+     y;
+ 
+@@ -203,6 +204,7 @@ static Image *ReadBGRImage(const ImageInfo *image_info,ExceptionInfo *exception)
+   scene=0;
+   status=MagickTrue;
+   stream=NULL;
++  columns=(ssize_t) MagickMin(image->columns,canvas_image->columns);
+   do
+   {
+     /*
+@@ -264,7 +266,7 @@ static Image *ReadBGRImage(const ImageInfo *image_info,ExceptionInfo *exception)
+               if ((p == (const Quantum *) NULL) ||
+                   (q == (Quantum *) NULL))
+                 break;
+-              for (x=0; x < (ssize_t) image->columns; x++)
++              for (x=0; x < columns; x++)
+               {
+                 SetPixelRed(image,GetPixelRed(canvas_image,p),q);
+                 SetPixelGreen(image,GetPixelGreen(canvas_image,p),q);
+@@ -347,7 +349,7 @@ static Image *ReadBGRImage(const ImageInfo *image_info,ExceptionInfo *exception)
+                 if ((p == (const Quantum *) NULL) ||
+                     (q == (Quantum *) NULL))
+                   break;
+-                for (x=0; x < (ssize_t) image->columns; x++)
++                for (x=0; x < columns; x++)
+                 {
+                   switch (quantum_type)
+                   {
+@@ -443,7 +445,7 @@ static Image *ReadBGRImage(const ImageInfo *image_info,ExceptionInfo *exception)
+               if ((p == (const Quantum *) NULL) ||
+                   (q == (Quantum *) NULL))
+                 break;
+-              for (x=0; x < (ssize_t) image->columns; x++)
++              for (x=0; x < columns; x++)
+               {
+                 SetPixelRed(image,GetPixelRed(canvas_image,p),q);
+                 p+=(ptrdiff_t) GetPixelChannels(canvas_image);
+@@ -496,7 +498,7 @@ static Image *ReadBGRImage(const ImageInfo *image_info,ExceptionInfo *exception)
+               if ((p == (const Quantum *) NULL) ||
+                   (q == (Quantum *) NULL))
+                 break;
+-              for (x=0; x < (ssize_t) image->columns; x++)
++              for (x=0; x < columns; x++)
+               {
+                 SetPixelGreen(image,GetPixelGreen(canvas_image,p),q);
+                 p+=(ptrdiff_t) GetPixelChannels(canvas_image);
+@@ -549,7 +551,7 @@ static Image *ReadBGRImage(const ImageInfo *image_info,ExceptionInfo *exception)
+               if ((p == (const Quantum *) NULL) ||
+                   (q == (Quantum *) NULL))
+                 break;
+-              for (x=0; x < (ssize_t) image->columns; x++)
++              for (x=0; x < columns; x++)
+               {
+                 SetPixelBlue(image,GetPixelBlue(canvas_image,p),q);
+                 p+=(ptrdiff_t) GetPixelChannels(canvas_image);
+@@ -611,7 +613,7 @@ static Image *ReadBGRImage(const ImageInfo *image_info,ExceptionInfo *exception)
+                   if ((p == (const Quantum *) NULL) ||
+                       (q == (Quantum *) NULL))
+                     break;
+-                  for (x=0; x < (ssize_t) image->columns; x++)
++                  for (x=0; x < columns; x++)
+                   {
+                     SetPixelAlpha(image,GetPixelAlpha(canvas_image,p),q);
+                     p+=(ptrdiff_t) GetPixelChannels(canvas_image);
+@@ -702,7 +704,7 @@ static Image *ReadBGRImage(const ImageInfo *image_info,ExceptionInfo *exception)
+               if ((p == (const Quantum *) NULL) ||
+                   (q == (Quantum *) NULL))
+                 break;
+-              for (x=0; x < (ssize_t) image->columns; x++)
++              for (x=0; x < columns; x++)
+               {
+                 SetPixelRed(image,GetPixelRed(canvas_image,p),q);
+                 p+=(ptrdiff_t) GetPixelChannels(canvas_image);
+@@ -774,7 +776,7 @@ static Image *ReadBGRImage(const ImageInfo *image_info,ExceptionInfo *exception)
+               if ((p == (const Quantum *) NULL) ||
+                   (q == (Quantum *) NULL))
+                 break;
+-              for (x=0; x < (ssize_t) image->columns; x++)
++              for (x=0; x < columns; x++)
+               {
+                 SetPixelGreen(image,GetPixelGreen(canvas_image,p),q);
+                 p+=(ptrdiff_t) GetPixelChannels(canvas_image);
+@@ -846,7 +848,7 @@ static Image *ReadBGRImage(const ImageInfo *image_info,ExceptionInfo *exception)
+               if ((p == (const Quantum *) NULL) ||
+                   (q == (Quantum *) NULL))
+                 break;
+-              for (x=0; x < (ssize_t) image->columns; x++)
++              for (x=0; x < columns; x++)
+               {
+                 SetPixelBlue(image,GetPixelBlue(canvas_image,p),q);
+                 p+=(ptrdiff_t) GetPixelChannels(canvas_image);
+@@ -920,7 +922,7 @@ static Image *ReadBGRImage(const ImageInfo *image_info,ExceptionInfo *exception)
+                   if ((p == (const Quantum *) NULL) ||
+                       (q == (Quantum *) NULL))
+                     break;
+-                  for (x=0; x < (ssize_t) image->columns; x++)
++                  for (x=0; x < columns; x++)
+                   {
+                     SetPixelAlpha(image,GetPixelAlpha(canvas_image,p),q);
+                     p+=(ptrdiff_t) GetPixelChannels(canvas_image);
+diff --git a/coders/cmyk.c b/coders/cmyk.c
+index 03f193ef4..3929bad95 100644
+--- a/coders/cmyk.c
++++ b/coders/cmyk.c
+@@ -125,6 +125,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
+     length;
+ 
+   ssize_t
++    columns,
+     count,
+     y;
+ 
+@@ -202,6 +203,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
+   scene=0;
+   status=MagickTrue;
+   stream=NULL;
++  columns=(ssize_t) MagickMin(image->columns,canvas_image->columns);
+   do
+   {
+     /*
+@@ -264,7 +266,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
+                 image->columns,1,exception);
+               if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
+                 break;
+-              for (x=0; x < (ssize_t) image->columns; x++)
++              for (x=0; x < columns; x++)
+               {
+                 SetPixelRed(image,GetPixelRed(canvas_image,p),q);
+                 SetPixelGreen(image,GetPixelGreen(canvas_image,p),q);
+@@ -348,7 +350,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
+                   image->columns,1,exception);
+                 if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
+                   break;
+-                for (x=0; x < (ssize_t) image->columns; x++)
++                for (x=0; x < columns; x++)
+                 {
+                   switch (quantum_type)
+                   {
+@@ -443,7 +445,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
+                 image->columns,1,exception);
+               if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
+                 break;
+-              for (x=0; x < (ssize_t) image->columns; x++)
++              for (x=0; x < columns; x++)
+               {
+                 SetPixelRed(image,GetPixelRed(canvas_image,p),q);
+                 p+=(ptrdiff_t) GetPixelChannels(canvas_image);
+@@ -495,7 +497,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
+                 image->columns,1,exception);
+               if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
+                 break;
+-              for (x=0; x < (ssize_t) image->columns; x++)
++              for (x=0; x < columns; x++)
+               {
+                 SetPixelGreen(image,GetPixelGreen(canvas_image,p),q);
+                 p+=(ptrdiff_t) GetPixelChannels(canvas_image);
+@@ -547,7 +549,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
+                 image->columns,1,exception);
+               if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
+                 break;
+-              for (x=0; x < (ssize_t) image->columns; x++)
++              for (x=0; x < columns; x++)
+               {
+                 SetPixelBlue(image,GetPixelBlue(canvas_image,p),q);
+                 p+=(ptrdiff_t) GetPixelChannels(canvas_image);
+@@ -599,7 +601,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
+                 image->columns,1,exception);
+               if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
+                 break;
+-              for (x=0; x < (ssize_t) image->columns; x++)
++              for (x=0; x < columns; x++)
+               {
+                 SetPixelBlack(image,GetPixelBlack(canvas_image,p),q);
+                 p+=(ptrdiff_t) GetPixelChannels(canvas_image);
+@@ -654,7 +656,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
+                     image->columns,1,exception);
+                   if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
+                     break;
+-                  for (x=0; x < (ssize_t) image->columns; x++)
++                  for (x=0; x < columns; x++)
+                   {
+                     SetPixelAlpha(image,GetPixelAlpha(canvas_image,p),q);
+                     p+=(ptrdiff_t) GetPixelChannels(canvas_image);
+@@ -744,7 +746,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
+                 image->columns,1,exception);
+               if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
+                 break;
+-              for (x=0; x < (ssize_t) image->columns; x++)
++              for (x=0; x < columns; x++)
+               {
+                 SetPixelRed(image,GetPixelRed(canvas_image,p),q);
+                 p+=(ptrdiff_t) GetPixelChannels(canvas_image);
+@@ -815,7 +817,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
+                 image->columns,1,exception);
+               if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
+                 break;
+-              for (x=0; x < (ssize_t) image->columns; x++)
++              for (x=0; x < columns; x++)
+               {
+                 SetPixelGreen(image,GetPixelGreen(canvas_image,p),q);
+                 p+=(ptrdiff_t) GetPixelChannels(canvas_image);
+@@ -887,7 +889,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
+               if ((p == (const Quantum *) NULL) ||
+                   (q == (Quantum *) NULL))
+                 break;
+-              for (x=0; x < (ssize_t) image->columns; x++)
++              for (x=0; x < columns; x++)
+               {
+                 SetPixelBlue(image,GetPixelBlue(canvas_image,p),q);
+                 p+=(ptrdiff_t) GetPixelChannels(canvas_image);
+@@ -959,7 +961,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
+               if ((p == (const Quantum *) NULL) ||
+                   (q == (Quantum *) NULL))
+                 break;
+-              for (x=0; x < (ssize_t) image->columns; x++)
++              for (x=0; x < columns; x++)
+               {
+                 SetPixelBlack(image,GetPixelBlack(canvas_image,p),q);
+                 p+=(ptrdiff_t) GetPixelChannels(canvas_image);
+@@ -1033,7 +1035,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
+                   if ((p == (const Quantum *) NULL) ||
+                       (q == (Quantum *) NULL))
+                     break;
+-                  for (x=0; x < (ssize_t) image->columns; x++)
++                  for (x=0; x < columns; x++)
+                   {
+                     SetPixelAlpha(image,GetPixelAlpha(canvas_image,p),q);
+                     p+=(ptrdiff_t) GetPixelChannels(canvas_image);
+diff --git a/coders/gray.c b/coders/gray.c
+index 14bdaf034..fc06b77f2 100644
+--- a/coders/gray.c
++++ b/coders/gray.c
+@@ -126,6 +126,7 @@ static Image *ReadGRAYImage(const ImageInfo *image_info,
+     length;
+ 
+   ssize_t
++    columns,
+     count,
+     y;
+ 
+@@ -203,6 +204,7 @@ static Image *ReadGRAYImage(const ImageInfo *image_info,
+   scene=0;
+   status=MagickTrue;
+   stream=NULL;
++  columns=(ssize_t) MagickMin(image->columns,canvas_image->columns);
+   do
+   {
+     /*
+@@ -263,7 +265,7 @@ static Image *ReadGRAYImage(const ImageInfo *image_info,
+                 image->columns,1,exception);
+               if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
+                 break;
+-              for (x=0; x < (ssize_t) image->columns; x++)
++              for (x=0; x < columns; x++)
+               {
+                 SetPixelRed(image,GetPixelRed(canvas_image,p),q);
+                 SetPixelGreen(image,GetPixelGreen(canvas_image,p),q);
+@@ -343,7 +345,7 @@ static Image *ReadGRAYImage(const ImageInfo *image_info,
+                   image->columns,1,exception);
+                 if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
+                   break;
+-                for (x=0; x < (ssize_t) image->columns; x++)
++                for (x=0; x < columns; x++)
+                 {
+                   switch (quantum_type)
+                   {
+@@ -423,7 +425,7 @@ static Image *ReadGRAYImage(const ImageInfo *image_info,
+                 image->columns,1,exception);
+               if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
+                 break;
+-              for (x=0; x < (ssize_t) image->columns; x++)
++              for (x=0; x < columns; x++)
+               {
+                 SetPixelGray(image,GetPixelGray(canvas_image,p),q);
+                 p+=(ptrdiff_t) GetPixelChannels(canvas_image);
+@@ -478,7 +480,7 @@ static Image *ReadGRAYImage(const ImageInfo *image_info,
+                     image->columns,1,exception);
+                   if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
+                     break;
+-                  for (x=0; x < (ssize_t) image->columns; x++)
++                  for (x=0; x < columns; x++)
+                   {
+                     SetPixelAlpha(image,GetPixelAlpha(canvas_image,p),q);
+                     p+=(ptrdiff_t) GetPixelChannels(canvas_image);
+@@ -568,7 +570,7 @@ static Image *ReadGRAYImage(const ImageInfo *image_info,
+                 image->columns,1,exception);
+               if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
+                 break;
+-              for (x=0; x < (ssize_t) image->columns; x++)
++              for (x=0; x < columns; x++)
+               {
+                 SetPixelRed(image,GetPixelRed(canvas_image,p),q);
+                 p+=(ptrdiff_t) GetPixelChannels(canvas_image);
+@@ -642,7 +644,7 @@ static Image *ReadGRAYImage(const ImageInfo *image_info,
+                     image->columns,1,exception);
+                   if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
+                     break;
+-                  for (x=0; x < (ssize_t) image->columns; x++)
++                  for (x=0; x < columns; x++)
+                   {
+                     SetPixelAlpha(image,GetPixelAlpha(canvas_image,p),q);
+                     p+=(ptrdiff_t) GetPixelChannels(canvas_image);
+diff --git a/coders/raw.c b/coders/raw.c
+index c7abd8798..ec3f6fb4b 100644
+--- a/coders/raw.c
++++ b/coders/raw.c
+@@ -119,6 +119,7 @@ static Image *ReadRAWImage(const ImageInfo *image_info,ExceptionInfo *exception)
+     length;
+ 
+   ssize_t
++    columns,
+     count,
+     y;
+ 
+@@ -187,6 +188,7 @@ static Image *ReadRAWImage(const ImageInfo *image_info,ExceptionInfo *exception)
+   length=0;
+   status=MagickTrue;
+   stream=NULL;
++  columns=(ssize_t) MagickMin(image->columns,canvas_image->columns);
+   do
+   {
+     /*
+@@ -239,7 +241,7 @@ static Image *ReadRAWImage(const ImageInfo *image_info,ExceptionInfo *exception)
+             1,exception);
+           if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
+             break;
+-          for (x=0; x < (ssize_t) image->columns; x++)
++          for (x=0; x < columns; x++)
+           {
+             SetPixelRed(image,GetPixelRed(canvas_image,p),q);
+             SetPixelGreen(image,GetPixelGreen(canvas_image,p),q);
+diff --git a/coders/rgb.c b/coders/rgb.c
+index 80b0f2d0f..a0c95fa2e 100644
+--- a/coders/rgb.c
++++ b/coders/rgb.c
+@@ -126,6 +126,7 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
+ 
+   ssize_t
+     count,
++    columns,
+     y;
+ 
+   unsigned char
+@@ -206,6 +207,7 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
+   scene=0;
+   status=MagickTrue;
+   stream=NULL;
++  columns=(ssize_t) MagickMin(image->columns,canvas_image->columns);
+   do
+   {
+     /*
+@@ -266,7 +268,7 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
+                 image->columns,1,exception);
+               if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
+                 break;
+-              for (x=0; x < (ssize_t) image->columns; x++)
++              for (x=0; x < columns; x++)
+               {
+                 SetPixelRed(image,GetPixelRed(canvas_image,p),q);
+                 SetPixelGreen(image,GetPixelGreen(canvas_image,p),q);
+@@ -350,7 +352,7 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
+                   image->columns,1,exception);
+                 if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
+                   break;
+-                for (x=0; x < (ssize_t) image->columns; x++)
++                for (x=0; x < columns; x++)
+                 {
+                   switch (quantum_type)
+                   {
+@@ -445,7 +447,7 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
+                 image->columns,1,exception);
+               if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
+                 break;
+-              for (x=0; x < (ssize_t) image->columns; x++)
++              for (x=0; x < columns; x++)
+               {
+                 SetPixelRed(image,GetPixelRed(canvas_image,p),q);
+                 p+=(ptrdiff_t) GetPixelChannels(canvas_image);
+@@ -497,7 +499,7 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
+                 image->columns,1,exception);
+               if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
+                 break;
+-              for (x=0; x < (ssize_t) image->columns; x++)
++              for (x=0; x < columns; x++)
+               {
+                 SetPixelGreen(image,GetPixelGreen(canvas_image,p),q);
+                 p+=(ptrdiff_t) GetPixelChannels(canvas_image);
+@@ -549,7 +551,7 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
+                 image->columns,1,exception);
+               if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
+                 break;
+-              for (x=0; x < (ssize_t) image->columns; x++)
++              for (x=0; x < columns; x++)
+               {
+                 SetPixelBlue(image,GetPixelBlue(canvas_image,p),q);
+                 p+=(ptrdiff_t) GetPixelChannels(canvas_image);
+@@ -603,7 +605,7 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
+                     image->columns,1,exception);
+                   if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
+                     break;
+-                  for (x=0; x < (ssize_t) image->columns; x++)
++                  for (x=0; x < columns; x++)
+                   {
+                     SetPixelAlpha(image,GetPixelAlpha(canvas_image,p),q);
+                     p+=(ptrdiff_t) GetPixelChannels(canvas_image);
+@@ -693,7 +695,7 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
+                 image->columns,1,exception);
+               if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
+                 break;
+-              for (x=0; x < (ssize_t) image->columns; x++)
++              for (x=0; x < columns; x++)
+               {
+                 SetPixelRed(image,GetPixelRed(canvas_image,p),q);
+                 p+=(ptrdiff_t) GetPixelChannels(canvas_image);
+@@ -764,7 +766,7 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
+                 image->columns,1,exception);
+               if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
+                 break;
+-              for (x=0; x < (ssize_t) image->columns; x++)
++              for (x=0; x < columns; x++)
+               {
+                 SetPixelGreen(image,GetPixelGreen(canvas_image,p),q);
+                 p+=(ptrdiff_t) GetPixelChannels(canvas_image);
+@@ -835,7 +837,7 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
+                 image->columns,1,exception);
+               if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
+                 break;
+-              for (x=0; x < (ssize_t) image->columns; x++)
++              for (x=0; x < columns; x++)
+               {
+                 SetPixelBlue(image,GetPixelBlue(canvas_image,p),q);
+                 p+=(ptrdiff_t) GetPixelChannels(canvas_image);
+@@ -908,7 +910,7 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
+                     image->columns,1,exception);
+                   if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
+                     break;
+-                  for (x=0; x < (ssize_t) image->columns; x++)
++                  for (x=0; x < columns; x++)
+                   {
+                     SetPixelAlpha(image,GetPixelAlpha(canvas_image,p),q);
+                     p+=(ptrdiff_t) GetPixelChannels(canvas_image);
+@@ -1025,6 +1027,7 @@ static Image *ReadRGB565Image(const ImageInfo *image_info,
+     length;
+ 
+   ssize_t
++    columns,
+     count,
+     y;
+ 
+@@ -1097,6 +1100,7 @@ static Image *ReadRGB565Image(const ImageInfo *image_info,
+   scene=0;
+   status=MagickTrue;
+   stream=NULL;
++  columns=(ssize_t) MagickMin(image->columns,canvas_image->columns);
+   do
+   {
+     /*
+@@ -1150,7 +1154,7 @@ static Image *ReadRGB565Image(const ImageInfo *image_info,
+             image->columns,1,exception);
+           if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
+             break;
+-          for (x=0; x < (ssize_t) image->columns; x++)
++          for (x=0; x < columns; x++)
+           {
+             unsigned short
+               pixel;
+diff --git a/coders/ycbcr.c b/coders/ycbcr.c
+index 00caf73a3..7f5cee14d 100644
+--- a/coders/ycbcr.c
++++ b/coders/ycbcr.c
+@@ -125,6 +125,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
+     length;
+ 
+   ssize_t
++    columns,
+     count,
+     y;
+ 
+@@ -202,6 +203,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
+   scene=0;
+   status=MagickTrue;
+   stream=NULL;
++  columns=(ssize_t) MagickMin(image->columns,canvas_image->columns);
+   do
+   {
+     /*
+@@ -264,7 +266,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
+                 image->columns,1,exception);
+               if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
+                 break;
+-              for (x=0; x < (ssize_t) image->columns; x++)
++              for (x=0; x < columns; x++)
+               {
+                 SetPixelRed(image,GetPixelRed(canvas_image,p),q);
+                 SetPixelGreen(image,GetPixelGreen(canvas_image,p),q);
+@@ -346,7 +348,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
+                   image->columns,1,exception);
+                 if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
+                   break;
+-                for (x=0; x < (ssize_t) image->columns; x++)
++                for (x=0; x < columns; x++)
+                 {
+                   switch (quantum_type)
+                   {
+@@ -436,7 +438,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
+                 image->columns,1,exception);
+               if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
+                 break;
+-              for (x=0; x < (ssize_t) image->columns; x++)
++              for (x=0; x < columns; x++)
+               {
+                 SetPixelRed(image,GetPixelRed(canvas_image,p),q);
+                 p+=(ptrdiff_t) GetPixelChannels(canvas_image);
+@@ -488,7 +490,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
+                 image->columns,1,exception);
+               if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
+                 break;
+-              for (x=0; x < (ssize_t) image->columns; x++)
++              for (x=0; x < columns; x++)
+               {
+                 SetPixelGreen(image,GetPixelGreen(canvas_image,p),q);
+                 p+=(ptrdiff_t) GetPixelChannels(canvas_image);
+@@ -540,7 +542,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
+                 image->columns,1,exception);
+               if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
+                 break;
+-              for (x=0; x < (ssize_t) image->columns; x++)
++              for (x=0; x < columns; x++)
+               {
+                 SetPixelBlue(image,GetPixelBlue(canvas_image,p),q);
+                 p+=(ptrdiff_t) GetPixelChannels(canvas_image);
+@@ -594,7 +596,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
+                     image->columns,1,exception);
+                   if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
+                     break;
+-                  for (x=0; x < (ssize_t) image->columns; x++)
++                  for (x=0; x < columns; x++)
+                   {
+                     SetPixelAlpha(image,GetPixelAlpha(canvas_image,p),q);
+                     p+=(ptrdiff_t) GetPixelChannels(canvas_image);
+@@ -684,7 +686,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
+                 image->columns,1,exception);
+               if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
+                 break;
+-              for (x=0; x < (ssize_t) image->columns; x++)
++              for (x=0; x < columns; x++)
+               {
+                 SetPixelRed(image,GetPixelRed(canvas_image,p),q);
+                 p+=(ptrdiff_t) GetPixelChannels(canvas_image);
+@@ -755,7 +757,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
+                 image->columns,1,exception);
+               if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
+                 break;
+-              for (x=0; x < (ssize_t) image->columns; x++)
++              for (x=0; x < columns; x++)
+               {
+                 SetPixelGreen(image,GetPixelGreen(canvas_image,p),q);
+                 p+=(ptrdiff_t) GetPixelChannels(canvas_image);
+@@ -826,7 +828,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
+                 image->columns,1,exception);
+               if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
+                 break;
+-              for (x=0; x < (ssize_t) image->columns; x++)
++              for (x=0; x < columns; x++)
+               {
+                 SetPixelBlue(image,GetPixelBlue(canvas_image,p),q);
+                 p+=(ptrdiff_t) GetPixelChannels(canvas_image);
+@@ -900,7 +902,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
+                     image->columns,1,exception);
+                   if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
+                     break;
+-                  for (x=0; x < (ssize_t) image->columns; x++)
++                  for (x=0; x < columns; x++)
+                   {
+                     SetPixelAlpha(image,GetPixelAlpha(canvas_image,p),q);
+                     p+=(ptrdiff_t) GetPixelChannels(canvas_image);
meta-oe/recipes-support/imagemagick/imagemagick_7.1.2-13.bb +1 -0
index 3e2d3ab344..6e0b42cd2a 100644
@@ -18,6 +18,7 @@ SRC_URI = "git://github.com/ImageMagick/ImageMagick.git;branch=main;protocol=htt
            file://CVE-2026-24481.patch \
            file://CVE-2026-24484.patch \
            file://CVE-2026-24485.patch \
+           file://CVE-2026-25576.patch \
            "
 
 SRCREV = "dd991e286b96918917a3392d6dc3ffc0e6907a4e"
#4 lore raw

PATCH 5/11 imagemagick: patch CVE-2026-25637

In reply to Gyorgy Sarvari

Details: https://nvd.nist.gov/vuln/detail/CVE-2026-25637

Backport the patch that is referenced by the NVD advisory.

---
 .../imagemagick/CVE-2026-25637.patch          | 41 +++++++++++++++++++
 .../imagemagick/imagemagick_7.1.2-13.bb       |  1 +
 2 files changed, 42 insertions(+)
 create mode 100644 meta-oe/recipes-support/imagemagick/imagemagick/CVE-2026-25637.patch
meta-oe/recipes-support/imagemagick/imagemagick/CVE-2026-25637.patch new file +41 -0
new file mode 100644
index 0000000000..030a833966
@@ -0,0 +1,41 @@
+From b5cf2b185d6b08eae82a401483623ab780dcfc25 Mon Sep 17 00:00:00 2001
+From: Dirk Lemstra <[email protected]>
+Date: Wed, 4 Feb 2026 17:19:53 +0100
+Subject: [PATCH] Fixed possible memory leak (GHSA-gm37-qx7w-p258)
+
+CVE: CVE-2026-25637
+Upstream-Status: Backport [https://github.com/ImageMagick/ImageMagick/commit/30ce0e8efbd72fd6b50ed3a10ae22f57c8901137]
+Signed-off-by: Gyorgy Sarvari <[email protected]>
+---
+ coders/ashlar.c | 7 ++++---
+ 1 file changed, 4 insertions(+), 3 deletions(-)
+
+diff --git a/coders/ashlar.c b/coders/ashlar.c
+index e94cd473d..a6c8c769c 100644
+--- a/coders/ashlar.c
++++ b/coders/ashlar.c
+@@ -655,13 +655,13 @@ static Image *ASHLARImage(ImageInfo *image_info,Image *image,
+           *label,
+           offset[MagickPathExtent];
+ 
+-        DrawInfo
+-          *draw_info = CloneDrawInfo(image_info,(DrawInfo *) NULL);
+-
+         label=InterpretImageProperties((ImageInfo *) image_info,tile_image,
+           value,exception);
+         if (label != (const char *) NULL)
+           {
++            DrawInfo
++              *draw_info = CloneDrawInfo(image_info,(DrawInfo *) NULL);
++
+             (void) CloneString(&draw_info->text,label);
+             label=DestroyString(label);
+             (void) FormatLocaleString(offset,MagickPathExtent,"%+g%+g",(double)
+@@ -669,6 +669,7 @@ static Image *ASHLARImage(ImageInfo *image_info,Image *image,
+               geometry.y/2.0+4);
+             (void) CloneString(&draw_info->geometry,offset);
+             status=AnnotateImage(ashlar_image,draw_info,exception);
++            draw_info=DestroyDrawInfo(draw_info);
+           }
+       }
+ #if defined(MAGICKCORE_OPENMP_SUPPORT)
meta-oe/recipes-support/imagemagick/imagemagick_7.1.2-13.bb +1 -0
index 6e0b42cd2a..362ce24e59 100644
@@ -19,6 +19,7 @@ SRC_URI = "git://github.com/ImageMagick/ImageMagick.git;branch=main;protocol=htt
            file://CVE-2026-24484.patch \
            file://CVE-2026-24485.patch \
            file://CVE-2026-25576.patch \
+           file://CVE-2026-25637.patch \
            "
 
 SRCREV = "dd991e286b96918917a3392d6dc3ffc0e6907a4e"
#5 lore raw

PATCH 6/11 imagemagick: patch CVE-2026-25638

In reply to Gyorgy Sarvari

Details: https://nvd.nist.gov/vuln/detail/CVE-2026-25638

Backport the patch that references the related github advisory[1] in its commit message.

Just a few commits later upstream decided to slightly change the same line in a new commit[2] - this patch contains that change too. (Though functionally they seem to do the same in this case:
the new version frees only one image, the original version was freeing an image list, by calling the function from the new version repeatedly).

[1]: https://github.com/ImageMagick/ImageMagick/security/advisories/GHSA-gxcx-qjqp-8vjw
[2]: https://github.com/ImageMagick/ImageMagick/commit/6a35526c7ce2b5dd690ded6c423b6eb6c0147967

---
 .../imagemagick/CVE-2026-25638.patch          | 26 +++++++++++++++++++
 .../imagemagick/imagemagick_7.1.2-13.bb       |  1 +
 2 files changed, 27 insertions(+)
 create mode 100644 meta-oe/recipes-support/imagemagick/imagemagick/CVE-2026-25638.patch
meta-oe/recipes-support/imagemagick/imagemagick/CVE-2026-25638.patch new file +26 -0
new file mode 100644
index 0000000000..df019d9f6b
@@ -0,0 +1,26 @@
+From 4a70293b882cd1bea92eab5eaa1951553109d636 Mon Sep 17 00:00:00 2001
+From: Dirk Lemstra <[email protected]>
+Date: Tue, 3 Feb 2026 22:06:12 +0100
+Subject: [PATCH] Fixed memory leak when writing MSL files
+ (GHSA-gxcx-qjqp-8vjw)
+
+CVE: CVE-2026-25638
+Upstream-Status: Backport [https://github.com/ImageMagick/ImageMagick/commit/1e88fca11c7b8517100d518bc99bd8c474f02f88 &&
+https://github.com/ImageMagick/ImageMagick/commit/6a35526c7ce2b5dd690ded6c423b6eb6c0147967]
+Signed-off-by: Gyorgy Sarvari <[email protected]>
+---
+ coders/msl.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/coders/msl.c b/coders/msl.c
+index 53e3a95d1..bf764f0d5 100644
+--- a/coders/msl.c
++++ b/coders/msl.c
+@@ -7887,6 +7887,7 @@ static MagickBooleanType WriteMSLImage(const ImageInfo *image_info,Image *image,
+     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
+   msl_image=CloneImage(image,0,0,MagickTrue,exception);
+   status=ProcessMSLScript(image_info,&msl_image,exception);
++  msl_image=DestroyImage(msl_image);
+   return(status);
+ }
+ #endif
meta-oe/recipes-support/imagemagick/imagemagick_7.1.2-13.bb +1 -0
index 362ce24e59..4b5a7fbb14 100644
@@ -20,6 +20,7 @@ SRC_URI = "git://github.com/ImageMagick/ImageMagick.git;branch=main;protocol=htt
            file://CVE-2026-24485.patch \
            file://CVE-2026-25576.patch \
            file://CVE-2026-25637.patch \
+           file://CVE-2026-25638.patch \
            "
 
 SRCREV = "dd991e286b96918917a3392d6dc3ffc0e6907a4e"
#6 lore raw

PATCH 7/11 imagemagick: patch CVE-2026-25794

In reply to Gyorgy Sarvari

Details: https://nvd.nist.gov/vuln/detail/CVE-2026-25794

Backport the patch that references the relevant Github advisory[1] in its commit message explicitly.

[1]: https://github.com/ImageMagick/ImageMagick/security/advisories/GHSA-vhqj-f5cj-9x8h

---
 .../imagemagick/CVE-2026-25794.patch          | 54 +++++++++++++++++++
 .../imagemagick/imagemagick_7.1.2-13.bb       |  1 +
 2 files changed, 55 insertions(+)
 create mode 100644 meta-oe/recipes-support/imagemagick/imagemagick/CVE-2026-25794.patch
meta-oe/recipes-support/imagemagick/imagemagick/CVE-2026-25794.patch new file +54 -0
new file mode 100644
index 0000000000..8eb9f14d57
@@ -0,0 +1,54 @@
+From c4f271dbcbe543b3395f83a1b5416927500c2aa4 Mon Sep 17 00:00:00 2001
+From: Dirk Lemstra <[email protected]>
+Date: Fri, 6 Feb 2026 21:03:53 +0100
+Subject: [PATCH] Prevent out of bounds heap write in uhdr encoder
+ (https://github.com/ImageMagick/ImageMagick/security/advisories/GHSA-vhqj-f5cj-9x8h)
+
+CVE: CVE-2026-25794
+Upstream-Status: Backport [https://github.com/ImageMagick/ImageMagick/commit/ffe589df5ff8ce1433daa4ccb0d2a9fadfbe30ed]
+Signed-off-by: Gyorgy Sarvari <[email protected]>
+---
+ coders/uhdr.c | 24 ++++++++++++++++--------
+ 1 file changed, 16 insertions(+), 8 deletions(-)
+
+diff --git a/coders/uhdr.c b/coders/uhdr.c
+index fc436595e..101d6a90f 100644
+--- a/coders/uhdr.c
++++ b/coders/uhdr.c
+@@ -618,20 +618,28 @@ static MagickBooleanType WriteUHDRImage(const ImageInfo *image_info,
+   {
+     /* Classify image as hdr/sdr intent basing on depth */
+     int
+-      bpp = image->depth >= hdrIntentMinDepth ? 2 : 1;
+-
+-    int
+-      aligned_width = image->columns + (image->columns & 1);
+-
+-    int
+-      aligned_height = image->rows + (image->rows & 1);
++      bpp;
+ 
+     ssize_t
+-      picSize = aligned_width * aligned_height * bpp * 1.5 /* 2x2 sub-sampling */;
++      aligned_height,
++      aligned_width;
++
++    size_t
++      picSize;
+ 
+     void
+       *crBuffer = NULL, *cbBuffer = NULL, *yBuffer = NULL;
+ 
++    if (((double) image->columns > sqrt(MAGICK_SSIZE_MAX/3.0)) ||
++        ((double) image->rows > sqrt(MAGICK_SSIZE_MAX/3.0)))
++      {
++        (void) ThrowMagickException(exception,GetMagickModule(),ImageError,
++          "WidthOrHeightExceedsLimit","%s",image->filename);
++        goto next_image;
++    }
++    bpp = image->depth >= hdrIntentMinDepth ? 2 : 1;
++    aligned_width = image->columns + (image->columns & 1);
++    picSize = aligned_width * aligned_height * bpp * 1.5 /* 2x2 sub-sampling */;
+     if (IssRGBCompatibleColorspace(image->colorspace) && !IsGrayColorspace(image->colorspace))
+     {
+       if (image->depth >= hdrIntentMinDepth && hdr_ct == UHDR_CT_LINEAR)
meta-oe/recipes-support/imagemagick/imagemagick_7.1.2-13.bb +1 -0
index 4b5a7fbb14..ab73da952c 100644
@@ -21,6 +21,7 @@ SRC_URI = "git://github.com/ImageMagick/ImageMagick.git;branch=main;protocol=htt
            file://CVE-2026-25576.patch \
            file://CVE-2026-25637.patch \
            file://CVE-2026-25638.patch \
+           file://CVE-2026-25794.patch \
            "
 
 SRCREV = "dd991e286b96918917a3392d6dc3ffc0e6907a4e"
#7 lore raw

PATCH 8/11 imagemagick: patch CVE-2026-25795

In reply to Gyorgy Sarvari

Details: https://nvd.nist.gov/vuln/detail/CVE-2026-25795

Backport the commit the references the related Github advisory[1] explicitly in its commit message.

[1]: https://github.com/ImageMagick/ImageMagick/security/advisories/GHSA-p33r-fqw2-rqmm

---
 .../imagemagick/CVE-2026-25795.patch          | 28 +++++++++++++++++++
 .../imagemagick/imagemagick_7.1.2-13.bb       |  1 +
 2 files changed, 29 insertions(+)
 create mode 100644 meta-oe/recipes-support/imagemagick/imagemagick/CVE-2026-25795.patch
meta-oe/recipes-support/imagemagick/imagemagick/CVE-2026-25795.patch new file +28 -0
new file mode 100644
index 0000000000..8ff74a43a6
@@ -0,0 +1,28 @@
+From 1a9ce954971581375f746fda76c73fc94c0b5535 Mon Sep 17 00:00:00 2001
+From: Dirk Lemstra <[email protected]>
+Date: Fri, 6 Feb 2026 21:16:10 +0100
+Subject: [PATCH] Fixed NULL pointer dereference in ReadSFWImage
+ (GHSA-p33r-fqw2-rqmm)
+
+CVE: CVE-2026-25795
+Upstream-Status: Backport [https://github.com/ImageMagick/ImageMagick/commit/0c7d0b9671ae2616fca106dcada45536eb4df5dc]
+Signed-off-by: Gyorgy Sarvari <[email protected]>
+---
+ coders/sfw.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/coders/sfw.c b/coders/sfw.c
+index f7ab1ef10..cc5fcedc6 100644
+--- a/coders/sfw.c
++++ b/coders/sfw.c
+@@ -317,9 +317,9 @@ static Image *ReadSFWImage(const ImageInfo *image_info,ExceptionInfo *exception)
+   if ((unique_file == -1) || (file == (FILE *) NULL))
+     {
+       buffer=(unsigned char *) RelinquishMagickMemory(buffer);
+-      read_info=DestroyImageInfo(read_info);
+       (void) CopyMagickString(image->filename,read_info->filename,
+         MagickPathExtent);
++      read_info=DestroyImageInfo(read_info);
+       ThrowFileException(exception,FileOpenError,"UnableToCreateTemporaryFile",
+         image->filename);
+       image=DestroyImageList(image);
meta-oe/recipes-support/imagemagick/imagemagick_7.1.2-13.bb +1 -0
index ab73da952c..8c1e8eb926 100644
@@ -22,6 +22,7 @@ SRC_URI = "git://github.com/ImageMagick/ImageMagick.git;branch=main;protocol=htt
            file://CVE-2026-25637.patch \
            file://CVE-2026-25638.patch \
            file://CVE-2026-25794.patch \
+           file://CVE-2026-25795.patch \
            "
 
 SRCREV = "dd991e286b96918917a3392d6dc3ffc0e6907a4e"
#8 lore raw

PATCH 9/11 imagemagick: patch CVE-2026-25796

In reply to Gyorgy Sarvari

Details: https://nvd.nist.gov/vuln/detail/CVE-2026-25796

Backport the patch that mentions the related Github advisory[1] in its commit message.

[1]: https://github.com/ImageMagick/ImageMagick/security/advisories/GHSA-g2pr-qxjg-7r2w

---
 .../imagemagick/CVE-2026-25796.patch          | 41 +++++++++++++++++++
 .../imagemagick/imagemagick_7.1.2-13.bb       |  1 +
 2 files changed, 42 insertions(+)
 create mode 100644 meta-oe/recipes-support/imagemagick/imagemagick/CVE-2026-25796.patch
meta-oe/recipes-support/imagemagick/imagemagick/CVE-2026-25796.patch new file +41 -0
new file mode 100644
index 0000000000..aa77f22066
@@ -0,0 +1,41 @@
+From 0564895c393d0aa21578739ad3126a447a4beace Mon Sep 17 00:00:00 2001
+From: Dirk Lemstra <[email protected]>
+Date: Fri, 6 Feb 2026 21:10:47 +0100
+Subject: [PATCH] Prevent memory leak in early exits (GHSA-g2pr-qxjg-7r2w)
+
+CVE: CVE-2026-25796
+Upstream-Status: Backport [https://github.com/ImageMagick/ImageMagick/commit/93ad259ce4f6d641eea0bee73f374af90f35efc3]
+Signed-off-by: Gyorgy Sarvari <[email protected]>
+---
+ coders/stegano.c | 11 +++++++++--
+ 1 file changed, 9 insertions(+), 2 deletions(-)
+
+diff --git a/coders/stegano.c b/coders/stegano.c
+index 9f5eb6b80..b68d6ce6d 100644
+--- a/coders/stegano.c
++++ b/coders/stegano.c
+@@ -150,15 +150,22 @@ static Image *ReadSTEGANOImage(const ImageInfo *image_info,
+     return(DestroyImage(image));
+   watermark->depth=MAGICKCORE_QUANTUM_DEPTH;
+   if (AcquireImageColormap(image,MaxColormapSize,exception) == MagickFalse)
+-    ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
++    {
++      watermark=DestroyImage(watermark);
++      ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
++    }
+   if (image_info->ping != MagickFalse)
+     {
++      watermark=DestroyImage(watermark);
+       (void) CloseBlob(image);
+       return(GetFirstImageInList(image));
+     }
+   status=SetImageExtent(image,image->columns,image->rows,exception);
+   if (status == MagickFalse)
+-    return(DestroyImageList(image));
++    {
++      watermark=DestroyImage(watermark);
++      return(DestroyImageList(image));
++    }
+   for (y=0; y < (ssize_t) image->rows; y++)
+   {
+     q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
meta-oe/recipes-support/imagemagick/imagemagick_7.1.2-13.bb +1 -0
index 8c1e8eb926..bb1272d512 100644
@@ -23,6 +23,7 @@ SRC_URI = "git://github.com/ImageMagick/ImageMagick.git;branch=main;protocol=htt
            file://CVE-2026-25638.patch \
            file://CVE-2026-25794.patch \
            file://CVE-2026-25795.patch \
+           file://CVE-2026-25796.patch \
            "
 
 SRCREV = "dd991e286b96918917a3392d6dc3ffc0e6907a4e"
#9 lore raw

PATCH 10/11 imagemagick: patch CVE-2026-25797

In reply to Gyorgy Sarvari

Details: https://nvd.nist.gov/vuln/detail/CVE-2026-25797

Backport the patch that mentions the related Github advisory[1] in its commit message.

[1]: https://github.com/ImageMagick/ImageMagick/security/advisories/GHSA-rw6c-xp26-225v

---
 .../imagemagick/CVE-2026-25797.patch          | 339 ++++++++++++++++++
 .../imagemagick/imagemagick_7.1.2-13.bb       |   1 +
 2 files changed, 340 insertions(+)
 create mode 100644 meta-oe/recipes-support/imagemagick/imagemagick/CVE-2026-25797.patch
meta-oe/recipes-support/imagemagick/imagemagick/CVE-2026-25797.patch new file +339 -0
new file mode 100644
index 0000000000..aa88a81203
@@ -0,0 +1,339 @@
+From cd63a33f1ec263e27049cdfb9d1345e1a4bd564f Mon Sep 17 00:00:00 2001
+From: Dirk Lemstra <[email protected]>
+Date: Fri, 6 Feb 2026 21:28:50 +0100
+Subject: [PATCH] Prevent code injection via PostScript header
+ (https://github.com/ImageMagick/ImageMagick/security/advisories/GHSA-rw6c-xp26-225v)
+
+CVE: CVE-2026-25797
+Upstream-Status: Backport [https://github.com/ImageMagick/ImageMagick/commit/26088a83d71e9daa203d54a56fe3c31f3f85463d]
+Signed-off-by: Gyorgy Sarvari <[email protected]>
+---
+ coders/ps.c  | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++-
+ coders/ps2.c | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++-
+ coders/ps3.c | 82 +++++++++++++++++++++++++++++++++++++++++++++++++++-
+ 3 files changed, 243 insertions(+), 3 deletions(-)
+
+diff --git a/coders/ps.c b/coders/ps.c
+index 66b08e8c7..d2ea34588 100644
+--- a/coders/ps.c
++++ b/coders/ps.c
+@@ -1086,6 +1086,82 @@ static inline unsigned char *PopHexPixel(const char hex_digits[][3],
+   return(pixels);
+ }
+ 
++static inline void FilenameToTitle(const char *filename,char *title,
++  const size_t extent)
++{
++  int
++    depth = 0;
++
++  ssize_t
++    i,
++    offset = 0;
++
++  if (extent == 0)
++    return;
++  for (i=0; (filename[i] != '\0') && ((offset+1) < (ssize_t) extent); i++)
++  {
++    unsigned char
++      c = filename[i];
++
++    /*
++      Only allow printable ASCII.
++    */
++    if ((c < 32) || (c > 126))
++      {
++        title[offset++]='_';
++        continue;
++      }
++    /*
++      Percent signs break DSC parsing.
++    */
++    if (c == '%')
++      {
++        title[offset++]='_';
++        continue;
++      }
++    /*
++      Parentheses must remain balanced.
++    */
++    if (c == '(')
++      {
++        depth++;
++        title[offset++] = '(';
++        continue;
++      }
++    if (c == ')')
++      {
++        if (depth <= 0)
++          title[offset++]='_';
++        else
++          {
++            depth--;
++            title[offset++]=')';
++          }
++         continue;
++     }
++    /*
++      Everything else is allowed.
++    */
++    title[offset++]=c;
++  }
++  /*
++    If parentheses remain unbalanced, close them.
++  */
++  while ((depth > 0) && ((offset+1) < (ssize_t) extent)) {
++    title[offset++]=')';
++    depth--;
++  }
++  title[offset]='\0';
++  /*
++    Ensure non-empty result.
++  */
++  if (offset == 0)
++    {
++      (void) CopyMagickString(title,"Untitled",extent-1);
++      title[extent-1]='\0';
++    }
++}
++
+ static MagickBooleanType WritePSImage(const ImageInfo *image_info,Image *image,
+   ExceptionInfo *exception)
+ {
+@@ -1554,6 +1630,9 @@ static MagickBooleanType WritePSImage(const ImageInfo *image_info,Image *image,
+       text_size=(size_t) (MultilineCensus(value)*pointsize+12);
+     if (page == 1)
+       {
++        char
++          title[MagickPathExtent];
++
+         /*
+           Output Postscript header.
+         */
+@@ -1564,8 +1643,9 @@ static MagickBooleanType WritePSImage(const ImageInfo *image_info,Image *image,
+             MagickPathExtent);
+         (void) WriteBlobString(image,buffer);
+         (void) WriteBlobString(image,"%%Creator: (ImageMagick)\n");
++        FilenameToTitle(image->filename,title,MagickPathExtent);
+         (void) FormatLocaleString(buffer,MagickPathExtent,"%%%%Title: (%s)\n",
+-          image->filename);
++          title);
+         (void) WriteBlobString(image,buffer);
+         timer=GetMagickTime();
+         (void) FormatMagickTime(timer,sizeof(date),date);
+diff --git a/coders/ps2.c b/coders/ps2.c
+index 82935dc8e..009129a98 100644
+--- a/coders/ps2.c
++++ b/coders/ps2.c
+@@ -225,6 +225,82 @@ static MagickBooleanType Huffman2DEncodeImage(const ImageInfo *image_info,
+   return(status);
+ }
+ 
++static inline void FilenameToTitle(const char *filename,char *title,
++  const size_t extent)
++{
++  int
++    depth = 0;
++
++  ssize_t
++    i,
++    offset = 0;
++
++  if (extent == 0)
++    return;
++  for (i=0; (filename[i] != '\0') && ((offset+1) < (ssize_t) extent); i++)
++  {
++    unsigned char
++      c = filename[i];
++
++    /*
++      Only allow printable ASCII.
++    */
++    if ((c < 32) || (c > 126))
++      {
++        title[offset++]='_';
++        continue;
++      }
++    /*
++      Percent signs break DSC parsing.
++    */
++    if (c == '%')
++      {
++        title[offset++]='_';
++        continue;
++      }
++    /*
++      Parentheses must remain balanced.
++    */
++    if (c == '(')
++      {
++        depth++;
++        title[offset++] = '(';
++        continue;
++      }
++    if (c == ')')
++      {
++        if (depth <= 0)
++          title[offset++]='_';
++        else
++          {
++            depth--;
++            title[offset++]=')';
++          }
++         continue;
++     }
++    /*
++      Everything else is allowed.
++    */
++    title[offset++]=c;
++  }
++  /*
++    If parentheses remain unbalanced, close them.
++  */
++  while ((depth > 0) && ((offset+1) < (ssize_t) extent)) {
++    title[offset++]=')';
++    depth--;
++  }
++  title[offset]='\0';
++  /*
++    Ensure non-empty result.
++  */
++  if (offset == 0)
++    {
++      (void) CopyMagickString(title,"Untitled",extent-1);
++      title[extent-1]='\0';
++    }
++}
++
+ static MagickBooleanType WritePS2Image(const ImageInfo *image_info,Image *image,
+   ExceptionInfo *exception)
+ {
+@@ -547,6 +623,9 @@ static MagickBooleanType WritePS2Image(const ImageInfo *image_info,Image *image,
+       text_size=(size_t) (MultilineCensus(value)*pointsize+12);
+     if (page == 1)
+       {
++        char
++          title[MagickPathExtent];
++
+         /*
+           Output Postscript header.
+         */
+@@ -557,8 +636,9 @@ static MagickBooleanType WritePS2Image(const ImageInfo *image_info,Image *image,
+             MagickPathExtent);
+         (void) WriteBlobString(image,buffer);
+         (void) WriteBlobString(image,"%%Creator: (ImageMagick)\n");
++        FilenameToTitle(image->filename,title,MagickPathExtent);
+         (void) FormatLocaleString(buffer,MagickPathExtent,"%%%%Title: (%s)\n",
+-          image->filename);
++          title);
+         (void) WriteBlobString(image,buffer);
+         timer=GetMagickTime();
+         (void) FormatMagickTime(timer,sizeof(date),date);
+diff --git a/coders/ps3.c b/coders/ps3.c
+index 77ddf050b..2b02d49b5 100644
+--- a/coders/ps3.c
++++ b/coders/ps3.c
+@@ -203,6 +203,82 @@ ModuleExport void UnregisterPS3Image(void)
+ %
+ */
+ 
++static inline void FilenameToTitle(const char *filename,char *title,
++  const size_t extent)
++{
++  int
++    depth = 0;
++
++  ssize_t
++    i,
++    offset = 0;
++
++  if (extent == 0)
++    return;
++  for (i=0; (filename[i] != '\0') && ((offset+1) < (ssize_t) extent); i++)
++  {
++    unsigned char
++      c = filename[i];
++
++    /*
++      Only allow printable ASCII.
++    */
++    if ((c < 32) || (c > 126))
++      {
++        title[offset++]='_';
++        continue;
++      }
++    /*
++      Percent signs break DSC parsing.
++    */
++    if (c == '%')
++      {
++        title[offset++]='_';
++        continue;
++      }
++    /*
++      Parentheses must remain balanced.
++    */
++    if (c == '(')
++      {
++        depth++;
++        title[offset++] = '(';
++        continue;
++      }
++    if (c == ')')
++      {
++        if (depth <= 0)
++          title[offset++]='_';
++        else
++          {
++            depth--;
++            title[offset++]=')';
++          }
++         continue;
++     }
++    /*
++      Everything else is allowed.
++    */
++    title[offset++]=c;
++  }
++  /*
++    If parentheses remain unbalanced, close them.
++  */
++  while ((depth > 0) && ((offset+1) < (ssize_t) extent)) {
++    title[offset++]=')';
++    depth--;
++  }
++  title[offset]='\0';
++  /*
++    Ensure non-empty result.
++  */
++  if (offset == 0)
++    {
++      (void) CopyMagickString(title,"Untitled",extent-1);
++      title[extent-1]='\0';
++    }
++}
++
+ static MagickBooleanType Huffman2DEncodeImage(const ImageInfo *image_info,
+   Image *image,Image *inject_image,ExceptionInfo *exception)
+ {
+@@ -1007,6 +1083,9 @@ static MagickBooleanType WritePS3Image(const ImageInfo *image_info,Image *image,
+     is_gray=IdentifyImageCoderGray(image,exception);
+     if (page == 1)
+       {
++        char
++          title[MagickPathExtent];
++
+         /*
+           Postscript header on the first page.
+         */
+@@ -1019,8 +1098,9 @@ static MagickBooleanType WritePS3Image(const ImageInfo *image_info,Image *image,
+         (void) FormatLocaleString(buffer,MagickPathExtent,
+           "%%%%Creator: ImageMagick %s\n",MagickLibVersionText);
+         (void) WriteBlobString(image,buffer);
++        FilenameToTitle(image->filename,title,MagickPathExtent);
+         (void) FormatLocaleString(buffer,MagickPathExtent,"%%%%Title: %s\n",
+-          image->filename);
++          title);
+         (void) WriteBlobString(image,buffer);
+         timer=GetMagickTime();
+         (void) FormatMagickTime(timer,sizeof(date),date);
meta-oe/recipes-support/imagemagick/imagemagick_7.1.2-13.bb +1 -0
index bb1272d512..2f6c8079cf 100644
@@ -24,6 +24,7 @@ SRC_URI = "git://github.com/ImageMagick/ImageMagick.git;branch=main;protocol=htt
            file://CVE-2026-25794.patch \
            file://CVE-2026-25795.patch \
            file://CVE-2026-25796.patch \
+           file://CVE-2026-25797.patch \
            "
 
 SRCREV = "dd991e286b96918917a3392d6dc3ffc0e6907a4e"
#10 lore raw

PATCH 11/11 imagemagick: patch CVE-2026-25798

In reply to Gyorgy Sarvari

Details: https://nvd.nist.gov/vuln/detail/CVE-2026-25798

Backport the patch that mentions the related Github advisory[1] in its commit message.

[1]: https://github.com/ImageMagick/ImageMagick/security/advisories/GHSA-p863-5fgm-rgq4

---
 .../imagemagick/CVE-2026-25798.patch          | 101 ++++++++++++++++++
 .../imagemagick/imagemagick_7.1.2-13.bb       |   1 +
 2 files changed, 102 insertions(+)
 create mode 100644 meta-oe/recipes-support/imagemagick/imagemagick/CVE-2026-25798.patch
meta-oe/recipes-support/imagemagick/imagemagick/CVE-2026-25798.patch new file +101 -0
new file mode 100644
index 0000000000..73814f8e12
@@ -0,0 +1,101 @@
+From a16b3ba623e773a35af509809f40bfa099d2da0c Mon Sep 17 00:00:00 2001
+From: Cristy <[email protected]>
+Date: Sun, 1 Feb 2026 14:56:14 -0500
+Subject: [PATCH] 
+ https://github.com/ImageMagick/ImageMagick/security/advisories/GHSA-p863-5fgm-rgq4
+
+CVE: CVE-2026-25798
+Upstream-Status: Backport [https://github.com/ImageMagick/ImageMagick/commit/16dd3158ce197c6f65e7798a7a5cc4538bb0303e]
+Signed-off-by: Gyorgy Sarvari <[email protected]>
+---
+ MagickCore/cache.c | 37 +++++++++++++++++++++++++++++++++----
+ coders/sixel.c     |  4 ++--
+ 2 files changed, 35 insertions(+), 6 deletions(-)
+
+diff --git a/MagickCore/cache.c b/MagickCore/cache.c
+index 5f44791bd..d0c63cebe 100644
+--- a/MagickCore/cache.c
++++ b/MagickCore/cache.c
+@@ -3561,6 +3561,25 @@ static MagickBooleanType MaskPixelCacheNexus(Image *image,NexusInfo *nexus_info,
+ %
+ */
+ 
++static inline MagickBooleanType CacheOverflowSanityCheckGetSize(
++  const MagickSizeType count,const size_t quantum,MagickSizeType *const extent)
++{
++  MagickSizeType
++    length;
++
++  if ((count == 0) || (quantum == 0))
++    return(MagickTrue);
++  length=count*quantum;
++  if (quantum != (length/count))
++    {
++      errno=ENOMEM;
++      return(MagickTrue);
++    }
++  if (extent != NULL)
++    *extent=length;
++  return(MagickFalse);
++}
++
+ static MagickBooleanType OpenPixelCacheOnDisk(CacheInfo *cache_info,
+   const MapMode mode)
+ {
+@@ -3711,7 +3730,7 @@ static MagickBooleanType OpenPixelCache(Image *image,const MapMode mode,
+     status;
+ 
+   MagickSizeType
+-    length,
++    length = 0,
+     number_pixels;
+ 
+   size_t
+@@ -3789,12 +3808,22 @@ static MagickBooleanType OpenPixelCache(Image *image,const MapMode mode,
+   packet_size=MagickMax(cache_info->number_channels,1)*sizeof(Quantum);
+   if (image->metacontent_extent != 0)
+     packet_size+=cache_info->metacontent_extent;
+-  length=number_pixels*packet_size;
++  if (CacheOverflowSanityCheckGetSize(number_pixels,packet_size,&length) != MagickFalse)
++    {
++      cache_info->storage_class=UndefinedClass;
++      cache_info->length=0;
++      ThrowBinaryException(ResourceLimitError,"PixelCacheAllocationFailed",
++      image->filename);
++    }
+   columns=(size_t) (length/cache_info->rows/packet_size);
+   if ((cache_info->columns != columns) || ((ssize_t) cache_info->columns < 0) ||
+       ((ssize_t) cache_info->rows < 0))
+-    ThrowBinaryException(ResourceLimitError,"PixelCacheAllocationFailed",
+-      image->filename);
++    {
++      cache_info->storage_class=UndefinedClass;
++      cache_info->length=0;
++      ThrowBinaryException(ResourceLimitError,"PixelCacheAllocationFailed",
++        image->filename);
++    }
+   cache_info->length=length;
+   if (image->ping != MagickFalse)
+     {
+diff --git a/coders/sixel.c b/coders/sixel.c
+index a0ae4b8b7..e9d941300 100644
+--- a/coders/sixel.c
++++ b/coders/sixel.c
+@@ -545,7 +545,7 @@ static MagickBooleanType sixel_decode(Image *image,unsigned char *p,
+                       if (max_x < position_x)
+                           max_x = position_x;
+                       if (max_y < (position_y + i))
+-                          max_y = position_y + i;
++                          max_y = (int) (position_y + i);
+                     }
+                   sixel_vertical_mask <<= 1;
+                 }
+@@ -578,7 +578,7 @@ static MagickBooleanType sixel_decode(Image *image,unsigned char *p,
+                       if (max_x < (position_x+repeat_count-1))
+                         max_x = position_x+repeat_count-1;
+                       if (max_y < (position_y+i+n-1))
+-                        max_y = position_y+i+n-1;
++                        max_y = (int) (position_y+i+n-1);
+                       i+=(n-1);
+                       sixel_vertical_mask <<= (n-1);
+                     }
meta-oe/recipes-support/imagemagick/imagemagick_7.1.2-13.bb +1 -0
index 2f6c8079cf..f4cceac88d 100644
@@ -25,6 +25,7 @@ SRC_URI = "git://github.com/ImageMagick/ImageMagick.git;branch=main;protocol=htt
            file://CVE-2026-25795.patch \
            file://CVE-2026-25796.patch \
            file://CVE-2026-25797.patch \
+           file://CVE-2026-25798.patch \
            "
 
 SRCREV = "dd991e286b96918917a3392d6dc3ffc0e6907a4e"
#11 lore raw
In reply to Gyorgy Sarvari

Grrrrr, drop this whole series... I just noticed that Whinlatter is using ImageMagick 7.1.2, and can be just updated... For some reason I was under the impression that it's using the previous version. Sorry for the noise.

Quoted 59 lines · Gyorgy Sarvari

Details: https://nvd.nist.gov/vuln/detail/CVE-2026-24481

Backport the patch that references the related Github advisory[1] in its description explicitly.

[1]: https://github.com/ImageMagick/ImageMagick/security/advisories/GHSA-96pc-27rx-pr36

---
 .../imagemagick/CVE-2026-24481.patch          | 25 +++++++++++++++++++
 .../imagemagick/imagemagick_7.1.2-13.bb       |  3 ++-
 2 files changed, 27 insertions(+), 1 deletion(-)
 create mode 100644 meta-oe/recipes-support/imagemagick/imagemagick/CVE-2026-24481.patch
meta-oe/recipes-support/imagemagick/imagemagick/CVE-2026-24481.patch new file +25 -0
new file mode 100644
index 0000000000..3d35a3f1d6
@@ -0,0 +1,25 @@
+From 6778a890f95971c61a16593abc2cd15376d22cdd Mon Sep 17 00:00:00 2001
+From: Dirk Lemstra <[email protected]>
+Date: Fri, 23 Jan 2026 13:19:06 +0100
+Subject: [PATCH] Initialize the pixels with empty values to prevent possible
+ heap information disclosure (GHSA-96pc-27rx-pr36)
+
+CVE: CVE-2026-24481
+Upstream-Status: Backport [https://github.com/ImageMagick/ImageMagick/commit/51c9d33f4770cdcfa1a029199375d570af801c97]
+Signed-off-by: Gyorgy Sarvari <[email protected]>
+---
+ coders/psd.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/coders/psd.c b/coders/psd.c
+index 28495c6d5..bb4ceecd6 100644
+--- a/coders/psd.c
++++ b/coders/psd.c
+@@ -1334,6 +1334,7 @@ static MagickBooleanType ReadPSDChannelZip(Image *image,
+       ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
+         image->filename);
+     }
++  memset(pixels,0,count*sizeof(*pixels));
+   if (ReadBlob(image,compact_size,compact_pixels) != (ssize_t) compact_size)
+     {
+       pixels=(unsigned char *) RelinquishMagickMemory(pixels);
meta-oe/recipes-support/imagemagick/imagemagick_7.1.2-13.bb +2 -1
index e3f4a96d6f..adf65880b6 100644
@@ -15,7 +15,8 @@ UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>([0-9][\.|_|-]?)+)"
 SRC_URI = "git://github.com/ImageMagick/ImageMagick.git;branch=main;protocol=https;tag=${PV} \
            file://run-ptest \
            file://imagemagick-ptest.sh \
-"
+           file://CVE-2026-24481.patch \
+           "
 
 SRCREV = "dd991e286b96918917a3392d6dc3ffc0e6907a4e"