File ImageMagick-CVE-2020-27755.patch of Package ImageMagick.30356
Index: ImageMagick-7.0.7-34/MagickCore/image.c
===================================================================
--- ImageMagick-7.0.7-34.orig/MagickCore/image.c 2020-12-08 18:20:16.288101448 +0100
+++ ImageMagick-7.0.7-34/MagickCore/image.c 2020-12-08 18:20:16.768104691 +0100
@@ -2639,8 +2639,18 @@ MagickExport MagickBooleanType SetImageE
ThrowBinaryException(ImageError,"NegativeOrZeroImageSize",image->filename);
image->columns=columns;
image->rows=rows;
- if ((image->depth == 0) || (image->depth > (8*sizeof(MagickSizeType))))
- ThrowBinaryException(ImageError,"ImageDepthNotSupported",image->filename);
+ if (image->depth == 0)
+ {
+ image->depth=8;
+ (void) ThrowMagickException(exception,GetMagickModule(),ImageError,
+ "ImageDepthNotSupported","`%s'",image->filename);
+ }
+ if (image->depth > (8*sizeof(MagickSizeType)))
+ {
+ image->depth=8*sizeof(MagickSizeType);
+ (void) ThrowMagickException(exception,GetMagickModule(),ImageError,
+ "ImageDepthNotSupported","`%s'",image->filename);
+ }
return(SyncImagePixelCache(image,exception));
}