Skip to contentSkip to conversation

imagemagick: patch CVE-2025-68618

PATCH New Gyorgy Sarvari 1 participant 3 messages Mar 11

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 imagemagick: patch CVE-2025-68618

Details: https://nvd.nist.gov/vuln/detail/CVE-2025-68618

Backport the commit that is referenced by the NVD advisory.

---
 .../imagemagick/CVE-2025-68618.patch          | 109 ++++++++++++++++++
 .../imagemagick/imagemagick_7.1.1.bb          |   1 +
 2 files changed, 110 insertions(+)
 create mode 100644 meta-oe/recipes-support/imagemagick/imagemagick/CVE-2025-68618.patch
meta-oe/recipes-support/imagemagick/imagemagick/CVE-2025-68618.patch new file +109 -0
new file mode 100644
index 0000000000..e5dcc248a8
@@ -0,0 +1,109 @@
+From 68f99b5094315eb3b4020f01bf9fab9a7c5c40a1 Mon Sep 17 00:00:00 2001
+From: Cristy <[email protected]>
+Date: Sun, 21 Dec 2025 12:43:08 -0500
+Subject: [PATCH] 
+ https://github.com/ImageMagick/ImageMagick/security/advisories/GHSA-p27m-hp98-6637
+
+CVE: CVE-2025-68618
+Upstream-Status: Backport [https://github.com/ImageMagick/ImageMagick/commit/6f431d445f3ddd609c004a1dde617b0a73e60beb]
+Signed-off-by: Gyorgy Sarvari <[email protected]>
+---
+ coders/msl.c | 24 ++++++++++++++++--------
+ coders/svg.c |  8 +++++++-
+ 2 files changed, 23 insertions(+), 9 deletions(-)
+
+diff --git a/coders/msl.c b/coders/msl.c
+index dc7a8bfd8..80468b1ff 100644
+--- a/coders/msl.c
++++ b/coders/msl.c
+@@ -120,6 +120,7 @@ typedef struct _MSLInfo
+     *exception;
+ 
+   ssize_t
++    depth,
+     n,
+     number_groups;
+ 
+@@ -328,6 +329,10 @@ static void MSLStartElement(void *context,const xmlChar *tag,
+   RectangleInfo
+     geometry;
+ 
++  size_t
++    height,
++    width;
++
+   ssize_t
+     i,
+     j,
+@@ -336,11 +341,6 @@ static void MSLStartElement(void *context,const xmlChar *tag,
+     x,
+     y;
+ 
+-
+-  size_t
+-    height,
+-    width;
+-
+   xmlParserCtxtPtr
+     parser;
+ 
+@@ -352,6 +352,13 @@ static void MSLStartElement(void *context,const xmlChar *tag,
+   exception=AcquireExceptionInfo();
+   parser=(xmlParserCtxtPtr) context;
+   msl_info=(MSLInfo *) parser->_private;
++  if (msl_info->depth++ >= MagickMaxRecursionDepth)
++    {        
++      (void) ThrowMagickException(msl_info->exception,GetMagickModule(),
++        DrawError,"VectorGraphicsNestedTooDeeply","`%s'",tag);
++      xmlStopParser((xmlParserCtxtPtr) context);
++      return;
++    }
+   n=msl_info->n;
+   keyword=(const char *) NULL;
+   value=(char *) NULL;
+@@ -7057,15 +7064,15 @@ static void MSLStartElement(void *context,const xmlChar *tag,
+ 
+ static void MSLEndElement(void *context,const xmlChar *tag)
+ {
+-  ssize_t
+-    n;
+-
+   MSLInfo
+     *msl_info;
+ 
+   xmlParserCtxtPtr
+     parser;
+ 
++  ssize_t
++    n;
++
+   /*
+     Called when the end of an element has been detected.
+   */
+@@ -7158,6 +7165,7 @@ static void MSLEndElement(void *context,const xmlChar *tag)
+   }
+   if (msl_info->content != (char *) NULL)
+     msl_info->content=DestroyString(msl_info->content);
++  msl_info->depth--;
+ }
+ 
+ static void MSLCharacters(void *context,const xmlChar *c,int length)
+diff --git a/coders/svg.c b/coders/svg.c
+index b1ac0783d..6a069745f 100644
+--- a/coders/svg.c
++++ b/coders/svg.c
+@@ -1249,7 +1249,13 @@ static void SVGStartElement(void *context,const xmlChar *name,
+     name);
+   parser=(xmlParserCtxtPtr) context;
+   svg_info=(SVGInfo *) parser->_private;
+-  svg_info->n++;
++  if (svg_info->n++ > MagickMaxRecursionDepth)
++    {
++      (void) ThrowMagickException(svg_info->exception,GetMagickModule(),
++        DrawError,"VectorGraphicsNestedTooDeeply","`%s'",name);
++      xmlStopParser((xmlParserCtxtPtr) context);
++      return;
++    }
+   svg_info->scale=(double *) ResizeQuantumMemory(svg_info->scale,(size_t)
+     svg_info->n+1,sizeof(*svg_info->scale));
+   if (svg_info->scale == (double *) NULL)
meta-oe/recipes-support/imagemagick/imagemagick_7.1.1.bb +1 -0
index 40e57b7f1d..0e52519558 100644
@@ -26,6 +26,7 @@ SRC_URI = "git://github.com/ImageMagick/ImageMagick.git;branch=main;protocol=htt
            file://CVE-2025-62171.patch \
            file://CVE-2025-65955.patch \
            file://CVE-2025-66628.patch \
+           file://CVE-2025-68618.patch \
            "
 SRCREV = "82572afc879b439cbf8c9c6f3a9ac7626adf98fb"
 
#1 lore raw

PATCH 2/3 imagemagick: patch CVE-2025-68950

Details: https://nvd.nist.gov/vuln/detail/CVE-2025-68950

Backport the patch that is referenced by the NVD advisory.

---
 .../imagemagick/CVE-2025-68950.patch          | 25 +++++++++++++++++++
 .../imagemagick/imagemagick_7.1.1.bb          |  1 +
 2 files changed, 26 insertions(+)
 create mode 100644 meta-oe/recipes-support/imagemagick/imagemagick/CVE-2025-68950.patch
meta-oe/recipes-support/imagemagick/imagemagick/CVE-2025-68950.patch new file +25 -0
new file mode 100644
index 0000000000..c0b49379a5
@@ -0,0 +1,25 @@
+From 0948d1ee1eb5c86d257e03c7bcdb738a3bbac549 Mon Sep 17 00:00:00 2001
+From: Cristy <[email protected]>
+Date: Fri, 26 Dec 2025 11:22:12 -0500
+Subject: [PATCH] 
+ https://github.com/ImageMagick/ImageMagick/security/advisories/GHSA-7rvh-xqp3-pr8j
+
+CVE: CVE-2025-68950
+Upstream-Status: Backport [https://github.com/ImageMagick/ImageMagick/commit/204718c2211903949dcfc0df8e65ed066b008dec]
+Signed-off-by: Gyorgy Sarvari <[email protected]>
+---
+ MagickCore/draw.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/MagickCore/draw.c b/MagickCore/draw.c
+index db555f654..7fe9675f5 100644
+--- a/MagickCore/draw.c
++++ b/MagickCore/draw.c
+@@ -5697,6 +5697,7 @@ MagickExport MagickBooleanType DrawPrimitive(Image *image,
+               if ((LocaleCompare(clone_info->magick,"ftp") != 0) &&
+                   (LocaleCompare(clone_info->magick,"http") != 0) &&
+                   (LocaleCompare(clone_info->magick,"https") != 0) &&
++                  (LocaleCompare(clone_info->magick,"mvg") != 0) &&
+                   (LocaleCompare(clone_info->magick,"vid") != 0))
+                 composite_images=ReadImage(clone_info,exception);
+               else
meta-oe/recipes-support/imagemagick/imagemagick_7.1.1.bb +1 -0
index 0e52519558..60e206e8f1 100644
@@ -27,6 +27,7 @@ SRC_URI = "git://github.com/ImageMagick/ImageMagick.git;branch=main;protocol=htt
            file://CVE-2025-65955.patch \
            file://CVE-2025-66628.patch \
            file://CVE-2025-68618.patch \
+           file://CVE-2025-68950.patch \
            "
 SRCREV = "82572afc879b439cbf8c9c6f3a9ac7626adf98fb"
 
#2 lore raw

PATCH 3/3 imagemagick: patch CVE-2025-69204

In reply to Gyorgy Sarvari

Details: https://nvd.nist.gov/vuln/detail/CVE-2025-69204

Backport the patch that is referenced by the NVD advisory.

---
 .../imagemagick/CVE-2025-69204.patch          | 71 +++++++++++++++++++
 .../imagemagick/imagemagick_7.1.1.bb          |  1 +
 2 files changed, 72 insertions(+)
 create mode 100644 meta-oe/recipes-support/imagemagick/imagemagick/CVE-2025-69204.patch
meta-oe/recipes-support/imagemagick/imagemagick/CVE-2025-69204.patch new file +71 -0
new file mode 100644
index 0000000000..855ed1a12e
@@ -0,0 +1,71 @@
+From 7167dbae8306f51d06da940b50c73452f72029f4 Mon Sep 17 00:00:00 2001
+From: Cristy <[email protected]>
+Date: Sat, 27 Dec 2025 14:37:23 -0500
+Subject: [PATCH] 
+ https://github.com/ImageMagick/ImageMagick/security/advisories/GHSA-hrh7-j8q2-4qcw
+
+CVE: CVE-2025-69204
+Upstream-Status: Backport [https://github.com/ImageMagick/ImageMagick/commit/2c08c2311693759153c9aa99a6b2dcb5f985681e]
+Signed-off-by: Gyorgy Sarvari <[email protected]>
+---
+ coders/svg.c | 27 ++++++++++++++++++++++-----
+ 1 file changed, 22 insertions(+), 5 deletions(-)
+
+diff --git a/coders/svg.c b/coders/svg.c
+index 6a069745f..09705fc39 100644
+--- a/coders/svg.c
++++ b/coders/svg.c
+@@ -1249,13 +1249,14 @@ static void SVGStartElement(void *context,const xmlChar *name,
+     name);
+   parser=(xmlParserCtxtPtr) context;
+   svg_info=(SVGInfo *) parser->_private;
+-  if (svg_info->n++ > MagickMaxRecursionDepth)
++  if (svg_info->n >= MagickMaxRecursionDepth)
+     {
+       (void) ThrowMagickException(svg_info->exception,GetMagickModule(),
+         DrawError,"VectorGraphicsNestedTooDeeply","`%s'",name);
+       xmlStopParser((xmlParserCtxtPtr) context);
+       return;
+     }
++  svg_info->n++;
+   svg_info->scale=(double *) ResizeQuantumMemory(svg_info->scale,(size_t)
+     svg_info->n+1,sizeof(*svg_info->scale));
+   if (svg_info->scale == (double *) NULL)
+@@ -4721,17 +4722,33 @@ static MagickBooleanType WriteSVGImage(const ImageInfo *image_info,Image *image,
+       }
+       case PathPrimitive:
+       {
+-        int
+-          number_attributes;
++        size_t
++          number_attributes,
++          quantum;
+ 
+         (void) GetNextToken(q,&q,extent,token);
+         number_attributes=1;
+         for (p=token; *p != '\0'; p++)
+           if (isalpha((int) ((unsigned char) *p)) != 0)
+             number_attributes++;
+-        if (i > ((ssize_t) number_points-6*BezierQuantum*number_attributes-1))
++        if ((6*BezierQuantum) >= (MAGICK_SSIZE_MAX/number_attributes))
+           {
+-            number_points+=(size_t) (6*BezierQuantum*number_attributes);
++            (void) ThrowMagickException(exception,GetMagickModule(),
++              ResourceLimitError,"MemoryAllocationFailed","`%s'",
++              image->filename);
++            break;
++          }
++        quantum=(size_t) 6*BezierQuantum*number_attributes;
++        if (number_points >= (MAGICK_SSIZE_MAX-quantum))
++          {
++            (void) ThrowMagickException(exception,GetMagickModule(),
++              ResourceLimitError,"MemoryAllocationFailed","`%s'",
++              image->filename);
++            break;
++          }
++        if (i > (ssize_t) (number_points-quantum-1))
++          {
++            number_points+=(size_t) quantum;
+             primitive_info=(PrimitiveInfo *) ResizeQuantumMemory(primitive_info,
+               number_points,sizeof(*primitive_info));
+             if (primitive_info == (PrimitiveInfo *) NULL)
meta-oe/recipes-support/imagemagick/imagemagick_7.1.1.bb +1 -0
index 60e206e8f1..ffc26e7169 100644
@@ -28,6 +28,7 @@ SRC_URI = "git://github.com/ImageMagick/ImageMagick.git;branch=main;protocol=htt
            file://CVE-2025-66628.patch \
            file://CVE-2025-68618.patch \
            file://CVE-2025-68950.patch \
+           file://CVE-2025-69204.patch \
            "
 SRCREV = "82572afc879b439cbf8c9c6f3a9ac7626adf98fb"