Commit 4a3585b0e for imagemagick.org
commit 4a3585b0e9aba893039eb8f09ded4afa23afe753
Author: Cristy <urban-warrior@imagemagick.org>
Date: Mon Jun 22 08:46:13 2026 -0400
https://github.com/ImageMagick/ImageMagick/security/advisories/GHSA-93x9-jq8c-cwcc
diff --git a/coders/tim2.c b/coders/tim2.c
index fc4a8f25f..c0bb7bf83 100644
--- a/coders/tim2.c
+++ b/coders/tim2.c
@@ -520,6 +520,9 @@ static MagickBooleanType ReadTIM2ImageData(const ImageInfo *image_info,
*/
clut_size=MagickMax(header->clut_size,(size_t) (clut_depth/8)*
image->colors);
+ if (clut_size > GetMaxMemoryRequest())
+ ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
+ image_info->filename);
clut_data=(unsigned char *) AcquireQuantumMemory(clut_size,
sizeof(*clut_data));
if (clut_data == (unsigned char *) NULL)