Commit 9c6f6367a for imagemagick.org
commit 9c6f6367a13057c7b3700849f490ec22f2a97e45
Author: Cristy <urban-warrior@imagemagick.org>
Date: Wed Jun 10 18:36:23 2026 -0400
https://github.com/ImageMagick/ImageMagick/discussions/8716#discussioncomment-17226843
diff --git a/coders/psd.c b/coders/psd.c
index 98b1b068a..0a258fa4c 100644
--- a/coders/psd.c
+++ b/coders/psd.c
@@ -1141,7 +1141,7 @@ static MagickBooleanType ReadPSDChannelRLE(Image *image,
if ((MagickOffsetType) length < sizes[y])
length=(size_t) sizes[y];
- if (length > (row_size+2048)) /* arbitrary number */
+ if (length > (2*row_size+1))
{
pixels=(unsigned char *) RelinquishMagickMemory(pixels);
ThrowBinaryException(ResourceLimitError,"InvalidLength",image->filename);