Commit 436e5d258 for imagemagick.org
commit 436e5d2589e3c0adc10d9aa189e81d5d088d8207
Author: Cristy <urban-warrior@imagemagick.org>
Date: Fri Feb 13 19:01:42 2026 -0500
https://github.com/ImageMagick/ImageMagick/security/advisories/GHSA-wgxp-q8xq-wpp9
diff --git a/coders/pcd.c b/coders/pcd.c
index 6714a4f88..5a773f4f5 100644
--- a/coders/pcd.c
+++ b/coders/pcd.c
@@ -321,12 +321,12 @@ static MagickBooleanType DecodeImage(Image *image,unsigned char *luma,
PCDGetBits(1);
continue;
}
+ if ((q < luma) || (q >= sentinel))
+ break;
if (r->key < 128)
quantum=(ssize_t) (*q)+r->key;
else
quantum=(ssize_t) (*q)+r->key-256;
- if ((q < luma) || (q >= sentinel))
- break;
*q=(unsigned char) ((quantum < 0) ? 0 : (quantum > 255) ? 255 : quantum);
q++;
PCDGetBits(r->length);