File ImageMagick-CVE-2026-25987.patch of Package ImageMagick.42999

From a842cd896a19744b5577b6113990faaae14569b0 Mon Sep 17 00:00:00 2001
From: Cristy <urban-warrior@imagemagick.org>
Date: Sat, 7 Feb 2026 18:03:17 -0500
Subject: [PATCH] 
 https://github.com/ImageMagick/ImageMagick/security/advisories/GHSA-42p5-62qq-mmh7

---
 coders/map.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/coders/map.c b/coders/map.c
index 83efb1315..df90c69eb 100644
--- a/coders/map.c
+++ b/coders/map.c
@@ -164,6 +164,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));

openSUSE Build Service is sponsored by