From e7435b48622bc6a6c074bcfbebdd6ced154e77ff Mon Sep 17 00:00:00 2001 From: Packit Date: Sep 17 2020 18:32:16 +0000 Subject: Apply patch libtiff-tiffdump.patch patch_name: libtiff-tiffdump.patch present_in_specfile: true --- diff --git a/tools/tiffdump.c b/tools/tiffdump.c index 5161189..58989a1 100644 --- a/tools/tiffdump.c +++ b/tools/tiffdump.c @@ -46,6 +46,7 @@ # include #endif +#include "tiffiop.h" #include "tiffio.h" #ifndef O_BINARY @@ -317,7 +318,7 @@ ReadDirectory(int fd, unsigned ix, off_t off) printf(">\n"); continue; } - space = dp->tdir_count * datawidth[dp->tdir_type]; + space = TIFFSafeMultiply(int, dp->tdir_count, datawidth[dp->tdir_type]); if (space <= 0) { printf(">\n"); Error("Invalid count for tag %u", dp->tdir_tag); @@ -709,7 +710,7 @@ TIFFFetchData(int fd, TIFFDirEntry* dir, void* cp) w = (dir->tdir_type < NWIDTHS ? datawidth[dir->tdir_type] : 0); cc = dir->tdir_count * w; if (lseek(fd, (off_t)dir->tdir_offset, 0) != (off_t)-1 - && read(fd, cp, cc) != -1) { + && read(fd, cp, cc) == cc) { if (swabflag) { switch (dir->tdir_type) { case TIFF_SHORT: