adds missing checks on TIFFGetField in tiffcrop tool (fixes #170)

This commit is contained in:
Bug Checkers 2019-11-04 21:14:38 +00:00 committed by Even Rouault
parent 91d4a30dbc
commit 47656ccb3f

View File

@ -1334,9 +1334,10 @@ static int writeBufferToSeparateTiles (TIFF* out, uint8* buf, uint32 imagelength
if (obuf == NULL) if (obuf == NULL)
return 1; return 1;
TIFFGetField(out, TIFFTAG_TILELENGTH, &tl); if( !TIFFGetField(out, TIFFTAG_TILELENGTH, &tl) ||
TIFFGetField(out, TIFFTAG_TILEWIDTH, &tw); !TIFFGetField(out, TIFFTAG_TILEWIDTH, &tw) ||
TIFFGetField(out, TIFFTAG_BITSPERSAMPLE, &bps); !TIFFGetField(out, TIFFTAG_BITSPERSAMPLE, &bps) )
return 1;
if( imagewidth == 0 || if( imagewidth == 0 ||
(uint32)bps * (uint32)spp > TIFF_UINT32_MAX / imagewidth || (uint32)bps * (uint32)spp > TIFF_UINT32_MAX / imagewidth ||