summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoger Leigh <rleigh@codelibre.net>2022-06-04 19:56:51 +0100
committerRoger Leigh <rleigh@codelibre.net>2022-06-04 19:56:51 +0100
commit7643b4c434bc0681e6cf65b886c6c9fa9ce7988e (patch)
tree4d490fca0a8aaac28c7d82fbf23b8426c051618c
parentfa8b983a268e44105644efc72291e232a0d96333 (diff)
downloadlibtiff-git-7643b4c434bc0681e6cf65b886c6c9fa9ce7988e.tar.gz
tiffdump: Avoid overflow warning when reading
-rw-r--r--tools/tiffdump.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/tiffdump.c b/tools/tiffdump.c
index 3d91c6ad..e4e239d1 100644
--- a/tools/tiffdump.c
+++ b/tools/tiffdump.c
@@ -192,7 +192,7 @@ dump(int fd, uint64_t diroff)
TIFFSwabShort(&hdr.common.tiff_version);
if (hdr.common.tiff_version==42)
{
- if (read(fd, (char*) &hdr.classic.tiff_diroff, 4) != 4)
+ if (read(fd, ((char*) &hdr.classic) + offsetof(TIFFHeaderClassic, tiff_diroff), 4) != 4)
ReadError("TIFF header");
if (swabflag)
TIFFSwabLong(&hdr.classic.tiff_diroff);
@@ -205,7 +205,7 @@ dump(int fd, uint64_t diroff)
}
else if (hdr.common.tiff_version==43)
{
- if (read(fd, (char*) &hdr.big.tiff_offsetsize, 12) != 12)
+ if (read(fd, ((char*) &hdr.big) + offsetof(TIFFHeaderBig, tiff_offsetsize), 12) != 12)
ReadError("TIFF header");
if (swabflag)
{