GraphicsMagick: coders/tga.c Check return code of seek blob oper...

GraphicsMagick Commits <[email protected]>
Newsgroups gmane.comp.video.graphicsmagick.cvs
Message-ID <mailman.1741.1665343648.1567.graphicsmagick-commit@lists.sourceforge.net>
changeset 89e32269c3b4 in /hg/GraphicsMagick
details: http://hg.GraphicsMagick.org/hg/GraphicsMagick?cmd=changeset;node=89e32269c3b4
summary: coders/tga.c Check return code of seek blob operation.

diffstat:

 ChangeLog    |   4 ++++
 coders/tga.c |  10 ++++++++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diffs (38 lines):

diff -r c53c2d494504 -r 89e32269c3b4 ChangeLog
--- a/ChangeLog	Sun Oct 09 10:34:38 2022 -0500
+++ b/ChangeLog	Sun Oct 09 21:26:58 2022 +0200
@@ -1,3 +1,7 @@
+2022-10-09    Fojtik Jaroslav  <[email protected]>
+
+        * coders/tga.c Check return code of seek blob operation.
+
 2022-10-09  Bob Friesenhahn  <[email protected]>
 
 	* magick/blob.c (SeekBlob): Fix SEEK_END validation.  Addresses
diff -r c53c2d494504 -r 89e32269c3b4 coders/tga.c
--- a/coders/tga.c	Sun Oct 09 10:34:38 2022 -0500
+++ b/coders/tga.c	Sun Oct 09 21:26:58 2022 +0200
@@ -320,7 +320,10 @@
      && image->logging)		/* TODO: Erase this line, footer is not doing anything usefull yet, logging only. */
   {
     status = MagickTrue;
-    SeekBlob(image,-26, SEEK_END);
+    if(SeekBlob(image,-26, SEEK_END) < 0)
+    {
+      ThrowReaderException(BlobError,UnableToSeekToOffset,image);
+    }
     tga_footer.ExtensionOffset = ReadBlobLSBLong(image);
     tga_footer.DevelopperDirOffset = ReadBlobLSBLong(image);
     if(ReadBlob(image, 16, tga_footer.Signature) != 16) status=MagickFail;
@@ -341,7 +344,10 @@
       memset(&tga_footer, 0, sizeof(tga_footer));
       status = MagickTrue;
     }
-    SeekBlob(image,3,SEEK_SET);
+    if(SeekBlob(image,3,SEEK_SET) != 3)
+    {
+      ThrowReaderException(BlobError,UnableToSeekToOffset,image);
+    }
   }
 
   do
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.