From: Dirk Lemstra <dirk@lemstra.org>
Date: Sat, 19 Feb 2022 07:46:46 +0100
Subject: Raise exception when image could not be read but no exception was
 raised.

Bail out in case of corrupted image

https://github.com/ImageMagick/ImageMagick6/commit/3e15c68efcb1e6383c93e7dfe38ba6c37e614d1b
(cherry picked from commit 3e15c68efcb1e6383c93e7dfe38ba6c37e614d1b)
---
 coders/tiff.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/coders/tiff.c b/coders/tiff.c
index aad3063..ac2771a 100644
--- a/coders/tiff.c
+++ b/coders/tiff.c
@@ -1264,6 +1264,8 @@ static Image *ReadTIFFImage(const ImageInfo *image_info,
     TIFFUnmapBlob);
   if (tiff == (TIFF *) NULL)
     {
+      if (exception->severity == UndefinedException)
+          ThrowReaderException(CorruptImageError,"UnableToReadImageData");
       image=DestroyImageList(image);
       return((Image *) NULL);
     }
