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

Index: ImageMagick-7.1.0-9/coders/psd.c
===================================================================
--- ImageMagick-7.1.0-9.orig/coders/psd.c
+++ ImageMagick-7.1.0-9/coders/psd.c
@@ -1058,7 +1058,7 @@ static MagickBooleanType ReadPSDChannelP
           number_bits=8;
         for (bit = 0; bit < (ssize_t) 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