GraphicsMagick: ReadTIFFImage(): Restore the previous assumption...

GraphicsMagick Commits <[email protected]>
Newsgroups gmane.comp.video.graphicsmagick.cvs
Message-ID <mailman.7193.1691328284.1439.graphicsmagick-commit@lists.sourceforge.net>
changeset 3d1f076bbcaf in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=3d1f076bbcaf
summary: ReadTIFFImage(): Restore the previous assumption that "Unsupported" tags return two arguments

diffstat:

 ChangeLog                              |   5 +++++
 VisualMagick/installer/inc/version.isx |   4 ++--
 coders/tiff.c                          |  21 ++++++++++++---------
 magick/version.h                       |   4 ++--
 www/Changelog.html                     |   7 +++++++
 5 files changed, 28 insertions(+), 13 deletions(-)

diffs (100 lines):

diff -r b69b1cb99d4b -r 3d1f076bbcaf ChangeLog
--- a/ChangeLog	Sat Aug 05 16:36:04 2023 -0500
+++ b/ChangeLog	Sun Aug 06 08:24:26 2023 -0500
@@ -1,3 +1,8 @@
+2023-08-06  Bob Friesenhahn  <[email protected]>
+
+	* coders/tiff.c (ReadTIFFImage): Default field pass count to 1
+	since "Unsupported" tags return two arguments.
+
 2023-08-05  Bob Friesenhahn  <[email protected]>
 
 	* jp2/src/libjasper/include/jasper/jas_types.h: MSVC 17.6.5 needs
diff -r b69b1cb99d4b -r 3d1f076bbcaf VisualMagick/installer/inc/version.isx
--- a/VisualMagick/installer/inc/version.isx	Sat Aug 05 16:36:04 2023 -0500
+++ b/VisualMagick/installer/inc/version.isx	Sun Aug 06 08:24:26 2023 -0500
@@ -10,5 +10,5 @@
 
 #define public MagickPackageName "GraphicsMagick"
 #define public MagickPackageVersion "1.4"
-#define public MagickPackageVersionAddendum ".020230805"
-#define public MagickPackageReleaseDate "snapshot-20230805"
+#define public MagickPackageVersionAddendum ".020230806"
+#define public MagickPackageReleaseDate "snapshot-20230806"
diff -r b69b1cb99d4b -r 3d1f076bbcaf coders/tiff.c
--- a/coders/tiff.c	Sat Aug 05 16:36:04 2023 -0500
+++ b/coders/tiff.c	Sun Aug 06 08:24:26 2023 -0500
@@ -2341,6 +2341,7 @@
 
       /*
         Convert TIFF tags to text attributes
+        https://gitlab.com/libtiff/libtiff/-/issues/575
       */
       {
         static const struct
@@ -2368,23 +2369,25 @@
           {
             const uint32 tag = text_tags[i].tag;
             const char *tag_name = text_tags[i].name;
-            int field_passcount;
+            int field_passcount=1; /* "Unsupported" tags return two arguments */
 #if TIFFLIB_VERSION <= 20111221
              /*
                Before tiff 4.0.0 (20111221), TIFFFieldWithTag returned
                TIFFFieldInfo * which provides field_passcount
              */
             const TIFFFieldInfo* tiff_field=TIFFFieldWithTag(tiff,tag);
-            field_passcount=tiff_field->field_passcount;
+            if (tiff_field != (const TIFFFieldInfo *))
+                field_passcount=tiff_field->field_passcount;
+            else
+              (void) LogMagickEvent(CoderEvent,GetMagickModule(),
+                                    "TIFFFieldWithTag() returns NULL for tag %u \"%s\"", tag, tag_name);
 #else
             const TIFFField *tiff_field=TIFFFieldWithTag(tiff,tag);
-            if (tiff_field == (const TIFFField *) NULL)
-              {
-                (void) LogMagickEvent(CoderEvent,GetMagickModule(),
-                                      "TIFFFieldWithTag() returns NULL for tag %u \"%s\"", tag, tag_name);
-                continue;
-              }
-            field_passcount=TIFFFieldPassCount(tiff_field);
+            if (tiff_field != (const TIFFField *) NULL)
+              field_passcount=TIFFFieldPassCount(tiff_field);
+            else
+              (void) LogMagickEvent(CoderEvent,GetMagickModule(),
+                                    "TIFFFieldWithTag() returns NULL for tag %u \"%s\"", tag, tag_name);
 #endif
 #if 0
             (void) LogMagickEvent(CoderEvent,GetMagickModule(),
diff -r b69b1cb99d4b -r 3d1f076bbcaf magick/version.h
--- a/magick/version.h	Sat Aug 05 16:36:04 2023 -0500
+++ b/magick/version.h	Sun Aug 06 08:24:26 2023 -0500
@@ -38,8 +38,8 @@
 #define MagickLibVersion  0x272402
 #define MagickLibVersionText  "1.4"
 #define MagickLibVersionNumber 27,24,2
-#define MagickChangeDate   "20230805"
-#define MagickReleaseDate  "snapshot-20230805"
+#define MagickChangeDate   "20230806"
+#define MagickReleaseDate  "snapshot-20230806"
 
 /*
   The MagickLibInterfaceNewest and MagickLibInterfaceOldest defines
diff -r b69b1cb99d4b -r 3d1f076bbcaf www/Changelog.html
--- a/www/Changelog.html	Sat Aug 05 16:36:04 2023 -0500
+++ b/www/Changelog.html	Sun Aug 06 08:24:26 2023 -0500
@@ -37,6 +37,13 @@
 </div>
 
 <div class="document">
+<p>2023-08-06  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): Default field pass count to 1
+since &quot;Unsupported&quot; tags return two arguments.</p></li>
+</ul>
+</blockquote>
 <p>2023-08-05  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">
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.