summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2019-11-04 21:14:38 +0000
committerEven Rouault <even.rouault@spatialys.com>2019-11-04 21:14:38 +0000
commitd0a8a3262cb9c0384e7ee77d7baf4eeb9d95db34 (patch)
tree4a5128e1d357200c6e8a0e39f6f6f6dbeba5c258
parent91d4a30dbcab5fdbf34cc1b874633435c579dc76 (diff)
parent47656ccb3f5847b5236c7fa236a0d8928fc50ce0 (diff)
downloadlibtiff-git-d0a8a3262cb9c0384e7ee77d7baf4eeb9d95db34.tar.gz
Merge branch 'fix-missing-checks-TIFFGetField-tiffcrop' into 'master'
adds missing checks on TIFFGetField in tiffcrop tool Closes #170 See merge request libtiff/libtiff!96
-rw-r--r--tools/tiffcrop.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/tools/tiffcrop.c b/tools/tiffcrop.c
index 7b3c9e78..29c19a2f 100644
--- a/tools/tiffcrop.c
+++ b/tools/tiffcrop.c
@@ -1334,9 +1334,10 @@ static int writeBufferToSeparateTiles (TIFF* out, uint8* buf, uint32 imagelength
if (obuf == NULL)
return 1;
- TIFFGetField(out, TIFFTAG_TILELENGTH, &tl);
- TIFFGetField(out, TIFFTAG_TILEWIDTH, &tw);
- TIFFGetField(out, TIFFTAG_BITSPERSAMPLE, &bps);
+ if( !TIFFGetField(out, TIFFTAG_TILELENGTH, &tl) ||
+ !TIFFGetField(out, TIFFTAG_TILEWIDTH, &tw) ||
+ !TIFFGetField(out, TIFFTAG_BITSPERSAMPLE, &bps) )
+ return 1;
if( imagewidth == 0 ||
(uint32)bps * (uint32)spp > TIFF_UINT32_MAX / imagewidth ||