From 5fa0c9d4376d879855fb154e166c90775530edf4 Mon Sep 17 00:00:00 2001
From: Cristy <urban-warrior@imagemagick.org>
Date: Wed, 16 Oct 2019 15:02:11 -0400
Subject: [PATCH] https://github.com/ImageMagick/ImageMagick/issues/1756

---
 magick/image.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/magick/image.c b/magick/image.c
index 90cec87..d462c9e 100644
--- a/magick/image.c
+++ b/magick/image.c
@@ -2703,9 +2703,18 @@ MagickExport MagickBooleanType SetImageExtent(Image *image,const size_t columns,
       image->filename);
   image->columns=columns;
   image->rows=rows;
-  if ((image->depth == 0) || (image->depth > (8*sizeof(MagickSizeType))))
-    ThrowBinaryImageException(ImageError,"ImageDepthNotSupported",
-      image->filename);
+  if (image->depth == 0)
+    {
+      image->depth=8;
+      (void) ThrowMagickException(&image->exception,GetMagickModule(),
+        ImageError,"ImageDepthNotSupported","`%s'",image->filename);
+    }
+  if (image->depth > (8*sizeof(MagickSizeType)))
+    {
+      image->depth=8*sizeof(MagickSizeType);
+      (void) ThrowMagickException(&image->exception,GetMagickModule(),
+        ImageError,"ImageDepthNotSupported","`%s'",image->filename);
+    }
   return(SyncImagePixelCache(image,&image->exception));
 }
 
-- 
2.30.0

