Commit ce021e9af for imagemagick.org
commit ce021e9af39f5600ba7e90cb72956ded3712dcfc
Author: Javid Khan <dxbjavid@gmail.com>
Date: Sun May 31 12:45:22 2026 +0530
reject hdr files with a negative width or height (#8765)
diff --git a/coders/hdr.c b/coders/hdr.c
index 3d3c355ba..1f2b83cd2 100644
--- a/coders/hdr.c
+++ b/coders/hdr.c
@@ -340,6 +340,9 @@ static Image *ReadHDRImage(const ImageInfo *image_info,ExceptionInfo *exception)
if (MagickSscanf(value,"%d +X %d",&height,&width) == 2)
{
+ if ((width <= 0) || (height <= 0))
+ ThrowReaderException(CorruptImageError,
+ "ImproperImageHeader");
image->columns=(size_t) width;
image->rows=(size_t) height;
}