File ImageMagick-CVE-2021-3574.patch of Package ImageMagick.30356
Index: ImageMagick-7.0.7-34/coders/tiff.c
===================================================================
--- ImageMagick-7.0.7-34.orig/coders/tiff.c
+++ ImageMagick-7.0.7-34/coders/tiff.c
@@ -1384,6 +1384,11 @@ RestoreMSCWarning
TIFFClose(tiff);
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
}
+ if (samples_per_pixel > MaxPixelChannels)
+ {
+ TIFFClose(tiff);
+ ThrowReaderException(CorruptImageError,"MaximumChannelsExceeded");
+ }
if (sample_format == SAMPLEFORMAT_IEEEFP)
(void) SetImageProperty(image,"quantum:format","floating-point",
exception);