Commit e8a61457c for imagemagick.org
commit e8a61457c90fcc632217cf5504da5c31e4b8d95c
Author: Cristy <urban-warrior@imagemagick.org>
Date: Mon Jun 1 07:14:17 2026 -0400
https://github.com/ImageMagick/ImageMagick/security/advisories/GHSA-44cp-c3ww-9rv5
diff --git a/coders/sf3.c b/coders/sf3.c
index baf6bafaf..5854ee74e 100644
--- a/coders/sf3.c
+++ b/coders/sf3.c
@@ -739,8 +739,13 @@ static MagickBooleanType WriteSF3Image(const ImageInfo *image_info,Image *image,
scene=0;
do
{
- const Quantum
- *magick_restrict p;
+ const Quantum *magick_restrict p;
+ if (SetQuantumDepth(image,quantum_info,quantum_info->depth) == MagickFalse)
+ {
+ (void) ThrowMagickException(exception,GetMagickModule(),
+ ResourceLimitError,"MemoryAllocationFailed","`%s'",image->filename);
+ break;
+ }
pixels=(unsigned char *) GetQuantumPixels(quantum_info);
for (y=0; y < (ssize_t) image->rows; y++)
{
@@ -748,7 +753,7 @@ static MagickBooleanType WriteSF3Image(const ImageInfo *image_info,Image *image,
if (p == (const Quantum *) NULL)
break;
length=ExportQuantumPixels(image,(CacheView *)NULL,quantum_info,
- quantum_type,pixels,exception);
+ quantum_type,pixels,exception);
checksum=crc32(checksum,pixels,length);
count=WriteBlob(image,length,pixels);
if (count != (ssize_t) length)