Commit 0ff264432 for imagemagick.org
commit 0ff264432086705bd30816fc8e4b349b6c3425e7
Author: Cristy <urban-warrior@imagemagick.org>
Date: Fri May 22 21:50:47 2026 -0400
potential heak based overflow per spartancodex
diff --git a/coders/yuv.c b/coders/yuv.c
index 3bc1a37da..38814a7fd 100644
--- a/coders/yuv.c
+++ b/coders/yuv.c
@@ -125,6 +125,7 @@ static Image *ReadYUVImage(const ImageInfo *image_info,ExceptionInfo *exception)
y;
size_t
+ extent,
length,
quantum;
@@ -144,6 +145,8 @@ static Image *ReadYUVImage(const ImageInfo *image_info,ExceptionInfo *exception)
image=AcquireImage(image_info,exception);
if ((image->columns == 0) || (image->rows == 0))
ThrowReaderException(OptionError,"MustSpecifyImageSize");
+ if (HeapOverflowSanityCheckGetSize(image->columns,4,&extent) != MagickFalse)
+ ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
status=SetImageExtent(image,image->columns,image->rows,exception);
if (status == MagickFalse)
return(DestroyImageList(image));