Skip to contentSkip to conversation

imagemagick: Fix CVE-2026-28493

PATCH New Bhabu Bindu 1 participant 2 messages Apr 16

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 imagemagick: Fix CVE-2026-28493

From: Bindu Bhabu <[email protected]>

Backport imagemagick commits [1][2][3] from
version 7.1.2-16 which fixes the vulnerability
according to Debian [4].

Patch hunks were refreshed as per codebase
of imagemagick_7.1.1.

[1] https://github.com/ImageMagick/ImageMagick/commit/6cefe972445185cbb9c76651231d52512e0ec14b
[2] https://github.com/ImageMagick/ImageMagick/commit/47a803cc139a6eebf14fca5f1d5dd25c7782cc98
[3] https://github.com/ImageMagick/ImageMagick/commit/cd7acd2c4bea5c953fae062d9ce43d11374dcb60
[4] https://security-tracker.debian.org/tracker/CVE-2026-28493

---
 .../imagemagick/CVE-2026-28493-1.patch        | 26 ++++++++++++++
 .../imagemagick/CVE-2026-28493-2.patch        | 34 +++++++++++++++++++
 .../imagemagick/CVE-2026-28493-3.patch        | 25 ++++++++++++++
 .../imagemagick/imagemagick_7.1.1.bb          |  3 ++
 4 files changed, 88 insertions(+)
 create mode 100644 meta-oe/recipes-support/imagemagick/imagemagick/CVE-2026-28493-1.patch
 create mode 100644 meta-oe/recipes-support/imagemagick/imagemagick/CVE-2026-28493-2.patch
 create mode 100644 meta-oe/recipes-support/imagemagick/imagemagick/CVE-2026-28493-3.patch
meta-oe/recipes-support/imagemagick/imagemagick/CVE-2026-28493-1.patch new file +26 -0
new file mode 100644
index 0000000000..f2f1c2fa44
@@ -0,0 +1,26 @@
+From 6cefe972445185cbb9c76651231d52512e0ec14b Mon Sep 17 00:00:00 2001
+From: Dirk Lemstra <[email protected]>
+Date: Sat, 28 Feb 2026 11:01:24 +0100
+Subject: [PATCH] Corrected typecast to avoid an out of bounds write
+ (GHSA-r39q-jr8h-gcq2)
+
+Upstream-Status: Backport [https://github.com/ImageMagick/ImageMagick/commit/6cefe972445185cbb9c76651231d52512e0ec14b]
+CVE: CVE-2026-28493
+Signed-off-by: Bhabu Bindu <[email protected]>
+---
+ coders/sixel.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/coders/sixel.c b/coders/sixel.c
+index 5de968e3581..a9ccd8a677a 100644
+--- a/coders/sixel.c
++++ b/coders/sixel.c
+@@ -573,7 +573,7 @@ static MagickBooleanType sixel_decode(Im
+                             return(MagickFalse);
+                           }
+                         for (x = 0; x < repeat_count; x++)
+-                          imbuf[(int) offset+x] = color_index;
++                          imbuf[(size_t) offset+x]=(sixel_pixel_t) color_index;
+                       }
+                       if (max_x < (position_x+repeat_count-1))
+                         max_x = position_x+repeat_count-1;
meta-oe/recipes-support/imagemagick/imagemagick/CVE-2026-28493-2.patch new file +34 -0
new file mode 100644
index 0000000000..872fc6f436
@@ -0,0 +1,34 @@
+From 47a803cc139a6eebf14fca5f1d5dd25c7782cc98 Mon Sep 17 00:00:00 2001
+From: Dirk Lemstra <[email protected]>
+Date: Sat, 28 Feb 2026 11:03:09 +0100
+Subject: [PATCH] Added checks for overflows.
+
+Upstream-Status: Backport [https://github.com/ImageMagick/ImageMagick/commit/47a803cc139a6eebf14fca5f1d5dd25c7782cc98]
+CVE: CVE-2026-28493
+Signed-off-by: Bhabu Bindu <[email protected]>
+---
+ coders/sixel.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/coders/sixel.c b/coders/sixel.c
+index a9ccd8a677a..d3a77aff219 100644
+--- a/coders/sixel.c
++++ b/coders/sixel.c
+@@ -536,7 +536,7 @@ static MagickBooleanType sixel_decode(Im
+                     {
+                       offset=(size_t) (imsx*((ssize_t) position_y+i)+
+                         (ssize_t) position_x);
+-                      if (offset >= (size_t) (imsx*imsy))
++                      if ((offset < 0) || (offset >= (imsx*imsy)))
+                         {
+                           imbuf=(sixel_pixel_t *) RelinquishMagickMemory(imbuf);
+                           return(MagickFalse);
+@@ -567,7 +567,7 @@ static MagickBooleanType sixel_decode(Im
+                       for (y = position_y + i; y < position_y + i + n; ++y)
+                       {
+                         offset=(size_t) ((ssize_t) imsx*y+(ssize_t) position_x);
+-                        if ((offset+(size_t) repeat_count) >= (size_t) (imsx*imsy))
++                        if ((offset < 0) || ((offset+repeat_count) >= (imsx*imsy)))
+                           {
+                             imbuf=(sixel_pixel_t *) RelinquishMagickMemory(imbuf);
+                             return(MagickFalse);
meta-oe/recipes-support/imagemagick/imagemagick/CVE-2026-28493-3.patch new file +25 -0
new file mode 100644
index 0000000000..4e756c2d1f
@@ -0,0 +1,25 @@
+From cd7acd2c4bea5c953fae062d9ce43d11374dcb60 Mon Sep 17 00:00:00 2001
+From: Jake Lodwick <[email protected]>
+Date: Sun, 1 Mar 2026 04:46:29 -0700
+Subject: [PATCH] Add overflow check to sixel write path (#8587)
+
+Upstream-Status: Backport [https://github.com/ImageMagick/ImageMagick/commit/cd7acd2c4bea5c953fae062d9ce43d11374dcb60]
+CVE: CVE-2026-28493
+Signed-off-by: Bhabu Bindu <[email protected]>
+---
+ coders/sixel.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/coders/sixel.c b/coders/sixel.c
+index d3a77aff219..b242959385d 100644
+--- a/coders/sixel.c
++++ b/coders/sixel.c
+@@ -815,6 +815,8 @@ static MagickBooleanType sixel_encode_impl(sixel_pixel_t *pixels,size_t width,
+   context->pos = 0;
+   if (ncolors < 1)
+     return(MagickFalse);
++  if (HeapOverflowSanityCheck(ncolors,width) != MagickFalse)
++    return(MagickFalse);
+   len=ncolors*width;
+   context->active_palette=(-1);
+   map=(sixel_pixel_t *) AcquireQuantumMemory(len,sizeof(sixel_pixel_t));
meta-oe/recipes-support/imagemagick/imagemagick_7.1.1.bb +3 -0
index ffc26e7169..09a56a1723 100644
@@ -29,6 +29,9 @@ SRC_URI = "git://github.com/ImageMagick/ImageMagick.git;branch=main;protocol=htt
            file://CVE-2025-68618.patch \
            file://CVE-2025-68950.patch \
            file://CVE-2025-69204.patch \
+           file://CVE-2026-28493-1.patch \
+           file://CVE-2026-28493-2.patch \
+           file://CVE-2026-28493-3.patch \
            "
 SRCREV = "82572afc879b439cbf8c9c6f3a9ac7626adf98fb"
 
Signature · 1 line
2.34.1
#1 lore raw

PATCH 2/2 imagemagick: Fix CVE-2026-28494

From: Bindu Bhabu <[email protected]>

Backport imagemagick commits [1] from version 7.1.2-16 which fixes the vulnerability according to Debian [2].

[1] https://github.com/ImageMagick/ImageMagick/commit/a3f2f8680fa01cbce731191789322419efb5954a
[2] https://security-tracker.debian.org/tracker/CVE-2026-28494

---
 .../imagemagick/CVE-2026-28494.patch          | 61 +++++++++++++++++++
 .../imagemagick/imagemagick_7.1.1.bb          |  1 +
 2 files changed, 62 insertions(+)
 create mode 100644 meta-oe/recipes-support/imagemagick/imagemagick/CVE-2026-28494.patch
meta-oe/recipes-support/imagemagick/imagemagick/CVE-2026-28494.patch new file +61 -0
new file mode 100644
index 0000000000..1f65d0131f
@@ -0,0 +1,61 @@
+From a3f2f8680fa01cbce731191789322419efb5954a Mon Sep 17 00:00:00 2001
+From: Dirk Lemstra <[email protected]>
+Date: Sat, 28 Feb 2026 11:31:15 +0100
+Subject: [PATCH] Added checks to avoid possible stack corruption
+ (GHSA-932h-jw47-73jm)
+
+Upstream-Status: Backport [https://github.com/ImageMagick/ImageMagick/commit/a3f2f8680fa01cbce731191789322419efb5954a]
+CVE: CVE-2026-28494
+Signed-off-by: Bhabu Bindu <[email protected]>
+---
+ MagickCore/morphology.c | 16 ++++++++++++----
+ 1 file changed, 12 insertions(+), 4 deletions(-)
+
+diff --git a/MagickCore/morphology.c b/MagickCore/morphology.c
+index 81bd2265438..727ac100180 100644
+--- a/MagickCore/morphology.c
++++ b/MagickCore/morphology.c
+@@ -234,6 +234,9 @@ static KernelInfo *ParseKernelArray(const char *kernel_string)
+   GeometryInfo
+     args;
+ 
++  size_t
++    length;
++
+   kernel=(KernelInfo *) AcquireMagickMemory(sizeof(*kernel));
+   if (kernel == (KernelInfo *) NULL)
+     return(kernel);
+@@ -261,8 +264,9 @@ static KernelInfo *ParseKernelArray(const char *kernel_string)
+   if ( p != (char *) NULL && p < end)
+     {
+       /* ParseGeometry() needs the geometry separated! -- Arrgghh */
+-      (void) memcpy(token, kernel_string, (size_t) (p-kernel_string));
+-      token[p-kernel_string] = '\0';
++      length=MagickMin((size_t) (p-kernel_string),sizeof(token)-1);
++      (void) memcpy(token, kernel_string, length);
++      token[length] = '\0';
+       SetGeometryInfo(&args);
+       flags = ParseGeometry(token, &args);
+ 
+@@ -388,6 +392,9 @@ static KernelInfo *ParseKernelName(const char *kernel_string,
+   MagickStatusType
+     flags;
+ 
++  size_t
++    length;
++
+   ssize_t
+     type;
+ 
+@@ -406,8 +413,9 @@ static KernelInfo *ParseKernelName(const char *kernel_string,
+     end = strchr(p, '\0');
+ 
+   /* ParseGeometry() needs the geometry separated! -- Arrgghh */
+-  (void) memcpy(token, p, (size_t) (end-p));
+-  token[end-p] = '\0';
++  length=MagickMin((size_t) (end-p),sizeof(token)-1);
++  (void) memcpy(token, p, length);
++  token[length] = '\0';
+   SetGeometryInfo(&args);
+   flags = ParseGeometry(token, &args);
+ 
meta-oe/recipes-support/imagemagick/imagemagick_7.1.1.bb +1 -0
index 09a56a1723..d85cdb27f3 100644
@@ -32,6 +32,7 @@ SRC_URI = "git://github.com/ImageMagick/ImageMagick.git;branch=main;protocol=htt
            file://CVE-2026-28493-1.patch \
            file://CVE-2026-28493-2.patch \
            file://CVE-2026-28493-3.patch \
+           file://CVE-2026-28494.patch \
            "
 SRCREV = "82572afc879b439cbf8c9c6f3a9ac7626adf98fb"
 
Signature · 1 line
2.34.1