diff --git a/coders/yuv.c b/coders/yuv.c index 38814a7fd7..01ef4d4849 100644 --- a/coders/yuv.c +++ b/coders/yuv.c @@ -145,7 +145,7 @@ 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) + if (HeapOverflowSanityCheckGetSize(image->columns,4*image->depth/8,&extent) != MagickFalse) ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed"); status=SetImageExtent(image,image->columns,image->rows,exception); if (status == MagickFalse)