Skip to content

Commit 986bddf

Browse files
author
Cristy
committed
https://github.com/ImageMagick/ImageMagick/security/advisories/GHSA-6hgw-6x87-578x
1 parent 14234b2 commit 986bddf

File tree

4 files changed

+66
-5
lines changed

4 files changed

+66
-5
lines changed

magick/artifact.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,21 @@
9797
% o clone_image: the clone image.
9898
%
9999
*/
100+
101+
typedef char
102+
*(*CloneKeyFunc)(const char *),
103+
*(*CloneValueFunc)(const char *);
104+
105+
static inline void *CloneArtifactKey(void *key)
106+
{
107+
return((void *) ((CloneKeyFunc) ConstantString)((const char *) key));
108+
}
109+
110+
static inline void *CloneArtifactValue(void *value)
111+
{
112+
return((void *) ((CloneValueFunc) ConstantString)((const char *) value));
113+
}
114+
100115
MagickExport MagickBooleanType CloneImageArtifacts(Image *image,
101116
const Image *clone_image)
102117
{
@@ -115,7 +130,7 @@ MagickExport MagickBooleanType CloneImageArtifacts(Image *image,
115130
if (image->artifacts != (void *) NULL)
116131
DestroyImageArtifacts(image);
117132
image->artifacts=CloneSplayTree((SplayTreeInfo *) clone_image->artifacts,
118-
(void *(*)(void *)) ConstantString,(void *(*)(void *)) ConstantString);
133+
CloneArtifactKey,CloneArtifactValue);
119134
}
120135
return(MagickTrue);
121136
}

magick/option.c

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1790,6 +1790,21 @@ static const OptionInfo
17901790
% o clone_info: the clone image info.
17911791
%
17921792
*/
1793+
1794+
typedef char
1795+
*(*CloneKeyFunc)(const char *),
1796+
*(*CloneValueFunc)(const char *);
1797+
1798+
static inline void *CloneOptionKey(void *key)
1799+
{
1800+
return((void *) ((CloneKeyFunc) ConstantString)((const char *) key));
1801+
}
1802+
1803+
static inline void *CloneOptionValue(void *value)
1804+
{
1805+
return((void *) ((CloneValueFunc) ConstantString)((const char *) value));
1806+
}
1807+
17931808
MagickExport MagickBooleanType CloneImageOptions(ImageInfo *image_info,
17941809
const ImageInfo *clone_info)
17951810
{
@@ -1805,7 +1820,7 @@ MagickExport MagickBooleanType CloneImageOptions(ImageInfo *image_info,
18051820
if (image_info->options != (void *) NULL)
18061821
DestroyImageOptions(image_info);
18071822
image_info->options=CloneSplayTree((SplayTreeInfo *) clone_info->options,
1808-
(void *(*)(void *)) ConstantString,(void *(*)(void *)) ConstantString);
1823+
CloneOptionKey,CloneOptionValue);
18091824
}
18101825
return(MagickTrue);
18111826
}

magick/profile.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,23 @@ static void
115115
% o clone_image: the clone image.
116116
%
117117
*/
118+
119+
typedef char
120+
*(*CloneKeyFunc)(const char *);
121+
122+
typedef StringInfo
123+
*(*CloneValueFunc)(const StringInfo *);
124+
125+
static inline void *CloneProfileKey(void *key)
126+
{
127+
return((void *) ((CloneKeyFunc) ConstantString)((const char *) key));
128+
}
129+
130+
static inline void *CloneProfileValue(void *value)
131+
{
132+
return((void *) ((CloneValueFunc) CloneStringInfo)((const StringInfo *) value));
133+
}
134+
118135
MagickExport MagickBooleanType CloneImageProfiles(Image *image,
119136
const Image *clone_image)
120137
{
@@ -133,7 +150,7 @@ MagickExport MagickBooleanType CloneImageProfiles(Image *image,
133150
if (image->profiles != (void *) NULL)
134151
DestroyImageProfiles(image);
135152
image->profiles=CloneSplayTree((SplayTreeInfo *) clone_image->profiles,
136-
(void *(*)(void *)) ConstantString,(void *(*)(void *)) CloneStringInfo);
153+
CloneProfileKey,CloneProfileValue);
137154
}
138155
return(MagickTrue);
139156
}

magick/property.c

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,21 @@
127127
% o clone_image: the clone image.
128128
%
129129
*/
130+
131+
typedef char
132+
*(*CloneKeyFunc)(const char *),
133+
*(*CloneValueFunc)(const char *);
134+
135+
static inline void *ClonePropertyKey(void *key)
136+
{
137+
return((void *) ((CloneKeyFunc) ConstantString)((const char *) key));
138+
}
139+
140+
static inline void *ClonePropertyValue(void *value)
141+
{
142+
return((void *) ((CloneValueFunc) ConstantString)((const char *) value));
143+
}
144+
130145
MagickExport MagickBooleanType CloneImageProperties(Image *image,
131146
const Image *clone_image)
132147
{
@@ -192,8 +207,7 @@ MagickExport MagickBooleanType CloneImageProperties(Image *image,
192207
if (image->properties != (void *) NULL)
193208
DestroyImageProperties(image);
194209
image->properties=CloneSplayTree((SplayTreeInfo *)
195-
clone_image->properties,(void *(*)(void *)) ConstantString,
196-
(void *(*)(void *)) ConstantString);
210+
clone_image->properties,ClonePropertyKey,ClonePropertyValue);
197211
}
198212
return(MagickTrue);
199213
}

0 commit comments

Comments
 (0)