GraphicsMagick: TGA: Remove defective validation of comment length

GraphicsMagick Commits <[email protected]>
Newsgroups gmane.comp.video.graphicsmagick.cvs
Message-ID <mailman.33837.1659641010.1510.graphicsmagick-commit@lists.sourceforge.net>
changeset 2504f4ed1a52 in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=2504f4ed1a52
summary: TGA: Remove defective validation of comment length

diffstat:

 ChangeLog                              |  6 ++++++
 VisualMagick/installer/inc/version.isx |  4 ++--
 coders/tga.c                           |  5 +----
 magick/version.h                       |  4 ++--
 www/Changelog.html                     |  5 +++++
 5 files changed, 16 insertions(+), 8 deletions(-)

diffs (82 lines):

diff -r 171c0dd24d8a -r 2504f4ed1a52 ChangeLog
--- a/ChangeLog	Sun Jul 31 09:23:17 2022 -0500
+++ b/ChangeLog	Thu Aug 04 14:23:15 2022 -0500
@@ -1,3 +1,9 @@
+2022-08-04  Bob Friesenhahn  <[email protected]>
+
+        * coders/tga.c (ReadTGAImage): Remove a defective validation of
+        comment length, which blocked reading some sample TGA files from
+        the "Encyclopedia Of Graphics File Formats" book.
+
 2022-07-31  Bob Friesenhahn  <[email protected]>
 
         * coders/heif.c: If module is compiled, but HasHEIF is not
diff -r 171c0dd24d8a -r 2504f4ed1a52 VisualMagick/installer/inc/version.isx
--- a/VisualMagick/installer/inc/version.isx	Sun Jul 31 09:23:17 2022 -0500
+++ b/VisualMagick/installer/inc/version.isx	Thu Aug 04 14:23:15 2022 -0500
@@ -10,5 +10,5 @@
 
 #define public MagickPackageName "GraphicsMagick"
 #define public MagickPackageVersion "1.4"
-#define public MagickPackageVersionAddendum ".020220731"
-#define public MagickPackageReleaseDate "snapshot-20220731"
+#define public MagickPackageVersionAddendum ".020220804"
+#define public MagickPackageReleaseDate "snapshot-20220804"
diff -r 171c0dd24d8a -r 2504f4ed1a52 coders/tga.c
--- a/coders/tga.c	Sun Jul 31 09:23:17 2022 -0500
+++ b/coders/tga.c	Thu Aug 04 14:23:15 2022 -0500
@@ -63,7 +63,7 @@
 typedef struct _TGAInfo
 {
   unsigned char
-    id_length,       /* Size of Image ID field */
+    id_length,       /* Size of Image ID field (starting after header) */
     colormap_type,   /* Color map type */
     image_type;      /* Image type code */
 
@@ -219,7 +219,6 @@
 
   const size_t headersize = 15;
   unsigned char readbuffer[15];
-  const size_t commentsize = 256;
   char commentbuffer[256];
   size_t readbufferpos = 0;
 
@@ -368,8 +367,6 @@
           /*
             TGA image comment.
           */
-          if (((size_t) tga_info.id_length+1) != commentsize)
-            ThrowReaderException(CorruptImageError,ImproperImageHeader,image);
           if (ReadBlob(image,tga_info.id_length,commentbuffer) != tga_info.id_length)
             ThrowReaderException(CorruptImageError,UnexpectedEndOfFile,image);
           commentbuffer[tga_info.id_length]='\0';
diff -r 171c0dd24d8a -r 2504f4ed1a52 magick/version.h
--- a/magick/version.h	Sun Jul 31 09:23:17 2022 -0500
+++ b/magick/version.h	Thu Aug 04 14:23:15 2022 -0500
@@ -38,8 +38,8 @@
 #define MagickLibVersion  0x272400
 #define MagickLibVersionText  "1.4"
 #define MagickLibVersionNumber 27,24,0
-#define MagickChangeDate   "20220731"
-#define MagickReleaseDate  "snapshot-20220731"
+#define MagickChangeDate   "20220804"
+#define MagickReleaseDate  "snapshot-20220804"
 
 /*
   The MagickLibInterfaceNewest and MagickLibInterfaceOldest defines
diff -r 171c0dd24d8a -r 2504f4ed1a52 www/Changelog.html
--- a/www/Changelog.html	Sun Jul 31 09:23:17 2022 -0500
+++ b/www/Changelog.html	Thu Aug 04 14:23:15 2022 -0500
@@ -35,6 +35,11 @@
 <div class="document">
 
 
+<p>2022-08-04  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>
+* coders/tga.c (ReadTGAImage): Remove a defective validation of
+comment length, which blocked reading some sample TGA files from
+the &quot;Encyclopedia Of Graphics File Formats&quot; book.</blockquote>
 <p>2022-07-31  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>
 <p>* coders/heif.c: If module is compiled, but HasHEIF is not
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.