Commit bbae0215e for imagemagick.org
commit bbae0215e1b76830509fd20e6d37c0dd7e3e4c3a
Author: Cristy <urban-warrior@imagemagick.org>
Date: Sat Feb 7 18:03:19 2026 -0500
https://github.com/ImageMagick/ImageMagick/security/advisories/GHSA-42p5-62qq-mmh7
diff --git a/coders/map.c b/coders/map.c
index 7fd645535..f77357549 100644
--- a/coders/map.c
+++ b/coders/map.c
@@ -160,6 +160,8 @@ static Image *ReadMAPImage(const ImageInfo *image_info,ExceptionInfo *exception)
if (status == MagickFalse)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
depth=GetImageQuantumDepth(image,MagickTrue);
+ if ((depth <= 8) && (image->colors > 256))
+ ThrowReaderException(CorruptImageError,"ImproperImageHeader");
packet_size=(size_t) (depth/8);
pixels=(unsigned char *) AcquireQuantumMemory(image->columns,packet_size*
sizeof(*pixels));
@@ -236,8 +238,8 @@ static Image *ReadMAPImage(const ImageInfo *image_info,ExceptionInfo *exception)
p++;
if (image->colors > 256)
{
- index=(Quantum) ConstrainColormapIndex(image,(ssize_t) (((size_t) index << 8)+
- (size_t) (*p)),exception);
+ index=(Quantum) ConstrainColormapIndex(image,(ssize_t)
+ (((size_t) index << 8)+(size_t) (*p)),exception);
p++;
}
SetPixelIndex(image,index,q);