Commit c930bf091 for imagemagick.org
commit c930bf091789b4b47358559a0357dad7f880b2ad
Author: Javid Khan <dxbjavid@gmail.com>
Date: Sun May 31 02:39:41 2026 +0530
reject pgx files with invalid dimensions or precision (#8764)
Co-authored-by: Dirk Lemstra <dirk@lemstra.org>
diff --git a/coders/pgx.c b/coders/pgx.c
index 1221ed542..299a5fa5a 100644
--- a/coders/pgx.c
+++ b/coders/pgx.c
@@ -185,6 +185,8 @@ static Image *ReadPGXImage(const ImageInfo *image_info,ExceptionInfo *exception)
sans,endian,sign,&precision,sans,&width,sans,&height);
if (count != 8)
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
+ if ((width <= 0) || (height <= 0) || (precision <= 0) || (precision > 64))
+ ThrowReaderException(CorruptImageError,"ImproperImageHeader");
image->depth=(size_t) precision;
if (LocaleCompare(endian,"ML") == 0)
image->endian=MSBEndian;