File ImageMagick-CVE-2025-55160.patch of Package ImageMagick.40311
From 986bddf243da88768e8198ee07c758768c098108 Mon Sep 17 00:00:00 2001
From: Cristy <urban-warrior@imagemagick.org>
Date: Sun, 10 Aug 2025 08:28:40 -0400
Subject: [PATCH]
https://github.com/ImageMagick/ImageMagick/security/advisories/GHSA-6hgw-6x87-578x
---
magick/artifact.c | 17 ++++++++++++++++-
magick/option.c | 17 ++++++++++++++++-
magick/profile.c | 19 ++++++++++++++++++-
magick/property.c | 18 ++++++++++++++++--
4 files changed, 66 insertions(+), 5 deletions(-)
Index: ImageMagick-6.8.8-1/magick/artifact.c
===================================================================
--- ImageMagick-6.8.8-1.orig/magick/artifact.c
+++ ImageMagick-6.8.8-1/magick/artifact.c
@@ -97,6 +97,21 @@
% o clone_image: the clone image.
%
*/
+
+typedef char
+ *(*CloneKeyFunc)(const char *),
+ *(*CloneValueFunc)(const char *);
+
+static inline void *CloneArtifactKey(void *key)
+{
+ return((void *) ((CloneKeyFunc) ConstantString)((const char *) key));
+}
+
+static inline void *CloneArtifactValue(void *value)
+{
+ return((void *) ((CloneValueFunc) ConstantString)((const char *) value));
+}
+
MagickExport MagickBooleanType CloneImageArtifacts(Image *image,
const Image *clone_image)
{
@@ -114,7 +129,7 @@ MagickExport MagickBooleanType CloneImag
if (image->artifacts != (void *) NULL)
DestroyImageArtifacts(image);
image->artifacts=CloneSplayTree((SplayTreeInfo *) clone_image->artifacts,
- (void *(*)(void *)) ConstantString,(void *(*)(void *)) ConstantString);
+ CloneArtifactKey,CloneArtifactValue);
}
return(MagickTrue);
}
Index: ImageMagick-6.8.8-1/magick/option.c
===================================================================
--- ImageMagick-6.8.8-1.orig/magick/option.c
+++ ImageMagick-6.8.8-1/magick/option.c
@@ -1679,6 +1679,21 @@ static const OptionInfo
% o clone_info: the clone image info.
%
*/
+
+typedef char
+ *(*CloneKeyFunc)(const char *),
+ *(*CloneValueFunc)(const char *);
+
+static inline void *CloneOptionKey(void *key)
+{
+ return((void *) ((CloneKeyFunc) ConstantString)((const char *) key));
+}
+
+static inline void *CloneOptionValue(void *value)
+{
+ return((void *) ((CloneValueFunc) ConstantString)((const char *) value));
+}
+
MagickExport MagickBooleanType CloneImageOptions(ImageInfo *image_info,
const ImageInfo *clone_info)
{
@@ -1694,7 +1709,7 @@ MagickExport MagickBooleanType CloneImag
if (image_info->options != (void *) NULL)
DestroyImageOptions(image_info);
image_info->options=CloneSplayTree((SplayTreeInfo *) clone_info->options,
- (void *(*)(void *)) ConstantString,(void *(*)(void *)) ConstantString);
+ CloneOptionKey,CloneOptionValue);
}
return(MagickTrue);
}
Index: ImageMagick-6.8.8-1/magick/profile.c
===================================================================
--- ImageMagick-6.8.8-1.orig/magick/profile.c
+++ ImageMagick-6.8.8-1/magick/profile.c
@@ -123,6 +123,23 @@
% o clone_image: the clone image.
%
*/
+
+typedef char
+ *(*CloneKeyFunc)(const char *);
+
+typedef StringInfo
+ *(*CloneValueFunc)(const StringInfo *);
+
+static inline void *CloneProfileKey(void *key)
+{
+ return((void *) ((CloneKeyFunc) ConstantString)((const char *) key));
+}
+
+static inline void *CloneProfileValue(void *value)
+{
+ return((void *) ((CloneValueFunc) CloneStringInfo)((const StringInfo *) value));
+}
+
MagickExport MagickBooleanType CloneImageProfiles(Image *image,
const Image *clone_image)
{
@@ -141,7 +158,7 @@ MagickExport MagickBooleanType CloneImag
if (image->profiles != (void *) NULL)
DestroyImageProfiles(image);
image->profiles=CloneSplayTree((SplayTreeInfo *) clone_image->profiles,
- (void *(*)(void *)) ConstantString,(void *(*)(void *)) CloneStringInfo);
+ CloneProfileKey,CloneProfileValue);
}
return(MagickTrue);
}
Index: ImageMagick-6.8.8-1/magick/property.c
===================================================================
--- ImageMagick-6.8.8-1.orig/magick/property.c
+++ ImageMagick-6.8.8-1/magick/property.c
@@ -119,6 +119,21 @@
% o clone_image: the clone image.
%
*/
+
+typedef char
+ *(*CloneKeyFunc)(const char *),
+ *(*CloneValueFunc)(const char *);
+
+static inline void *ClonePropertyKey(void *key)
+{
+ return((void *) ((CloneKeyFunc) ConstantString)((const char *) key));
+}
+
+static inline void *ClonePropertyValue(void *value)
+{
+ return((void *) ((CloneValueFunc) ConstantString)((const char *) value));
+}
+
MagickExport MagickBooleanType CloneImageProperties(Image *image,
const Image *clone_image)
{
@@ -183,8 +198,7 @@ MagickExport MagickBooleanType CloneImag
if (image->properties != (void *) NULL)
DestroyImageProperties(image);
image->properties=CloneSplayTree((SplayTreeInfo *)
- clone_image->properties,(void *(*)(void *)) ConstantString,
- (void *(*)(void *)) ConstantString);
+ clone_image->properties,ClonePropertyKey,ClonePropertyValue);
}
return(MagickTrue);
}