From 38e3984b95ed5dc9820cba7af13c9a000eba9742 Mon Sep 17 00:00:00 2001 From: pgajdos Date: Tue, 13 Nov 2018 09:03:31 +0100 Subject: [PATCH 06/10] prevent integer overflow --- tools/tiffcp.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tools/tiffcp.c b/tools/tiffcp.c index 2903461..754ee9f 100644 --- a/tools/tiffcp.c +++ b/tools/tiffcp.c @@ -1402,6 +1402,12 @@ DECLAREreadFunc(readSeparateTilesIntoBuffer) status = 0; goto done; } + if (0xFFFFFFFF / tilew < spp) + { + TIFFError(TIFFFileName(in), "Error, either TileWidth (%u) or BitsPerSample (%u) is too large", tilew, bps); + status = 0; + goto done; + } /* * Tile is clipped horizontally. Calculate * visible portion and skewing factors. -- 2.17.2