GraphicsMagick: ReadTIFFImage(): Fix garbled logic pertaining to...

GraphicsMagick Commits <[email protected]> Wed, 09 Aug 2023 10:58:57 -0500
Newsgroups gmane.comp.video.graphicsmagick.cvs
Message-ID <mailman.7793.1691596744.1374.graphicsmagick-commit@lists.sourceforge.net>
changeset 3c24d655b52c in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=3c24d655b52c
summary: ReadTIFFImage(): Fix garbled logic pertaining to photometric checks

diffstat:

 ChangeLog          |  4 ++++
 coders/tiff.c      |  3 ++-
 www/Changelog.html |  3 +++
 3 files changed, 9 insertions(+), 1 deletions(-)

diffs (45 lines):

diff -r 7d011aea3026 -r 3c24d655b52c ChangeLog
--- a/ChangeLog	Wed Aug 09 10:52:03 2023 -0500
+++ b/ChangeLog	Wed Aug 09 10:58:53 2023 -0500
@@ -1,5 +1,9 @@
 2023-08-09  Bob Friesenhahn  <[email protected]>
 
+	* coders/tiff.c (ReadTIFFImage): Fix garbled logic pertaining to
+	photometric checks.  Addresses Coverity 393177 "Structurally dead
+	code".
+
 	* coders/heif.c (ReadHEIFImage): For libheif versions <
 	0x01090000, ignore_transformations is always 1. Add a conditional
 	check to avoid Coverity 384803 "Logically dead code" for old
diff -r 7d011aea3026 -r 3c24d655b52c coders/tiff.c
--- a/coders/tiff.c	Wed Aug 09 10:52:03 2023 -0500
+++ b/coders/tiff.c	Wed Aug 09 10:58:53 2023 -0500
@@ -2459,13 +2459,14 @@
                                     "%s compression requires 1 bits per sample!",
                                     CompressionTagToString(compress_tag));
               ThrowTIFFReaderException(CorruptImageError,ImproperImageHeader,image);
+            }
+          if ((PHOTOMETRIC_MINISBLACK != photometric) && (PHOTOMETRIC_MINISWHITE != photometric))
             {
               (void) LogMagickEvent(CoderEvent,GetMagickModule(),
                                     "%s compression requires photometric of minisblack or miniswhite!",
                                     CompressionTagToString(compress_tag));
               ThrowTIFFReaderException(CorruptImageError,ImproperImageHeader,image);
             }
-            }
         }
 #endif /* if defined(COMPRESSION_CCITTFAX3) */
 #if defined(COMPRESSION_CCITTFAX4)
diff -r 7d011aea3026 -r 3c24d655b52c www/Changelog.html
--- a/www/Changelog.html	Wed Aug 09 10:52:03 2023 -0500
+++ b/www/Changelog.html	Wed Aug 09 10:58:53 2023 -0500
@@ -40,6 +40,9 @@
 <p>2023-08-09  Bob Friesenhahn  &lt;<a class="reference external" href="mailto:bfriesen&#37;&#52;&#48;simple&#46;dallas&#46;tx&#46;us">bfriesen<span>&#64;</span>simple<span>&#46;</span>dallas<span>&#46;</span>tx<span>&#46;</span>us</a>&gt;</p>
 <blockquote>
 <ul class="simple">
+<li><p>coders/tiff.c (ReadTIFFImage): Fix garbled logic pertaining to
+photometric checks.  Addresses Coverity 393177 &quot;Structurally dead
+code&quot;.</p></li>
 <li><p>coders/heif.c (ReadHEIFImage): For libheif versions &lt;
 0x01090000, ignore_transformations is always 1. Add a conditional
 check to avoid Coverity 384803 &quot;Logically dead code&quot; for old
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.