File ImageMagick-CVE-2022-32545.patch of Package ImageMagick.30356

Index: ImageMagick-7.0.7-34/coders/psd.c
===================================================================
--- ImageMagick-7.0.7-34.orig/coders/psd.c
+++ ImageMagick-7.0.7-34/coders/psd.c
@@ -1047,7 +1047,7 @@ static MagickBooleanType ReadPSDChannelP
           number_bits=8;
         for (bit = 0; bit < number_bits; bit++)
         {
-          SetPSDPixel(image,channels,type,packet_size,(((unsigned char) pixel)
+          SetPSDPixel(image,channels,type,packet_size,(((unsigned char)((ssize_t)pixel))
             & (0x01 << (7-bit))) != 0 ? 0 : QuantumRange,q,exception);
           q+=GetPixelChannels(image);
           x++;
openSUSE Build Service is sponsored by