EstimateStripByteCounts(): avoid unsigned integer overflow

This commit is contained in:
Even Rouault 2019-08-22 10:19:44 +02:00
parent 761d50e34d
commit c8f268ef1b
No known key found for this signature in database
GPG Key ID: 33EBBFC47B3DD87D

View File

@ -4549,6 +4549,8 @@ EstimateStripByteCounts(TIFF* tif, TIFFDirEntry* dir, uint16 dircount)
dp->tdir_type); dp->tdir_type);
return -1; return -1;
} }
if( dp->tdir_count > TIFF_UINT64_MAX / typewidth )
return -1;
datasize=(uint64)typewidth*dp->tdir_count; datasize=(uint64)typewidth*dp->tdir_count;
if (!(tif->tif_flags&TIFF_BIGTIFF)) if (!(tif->tif_flags&TIFF_BIGTIFF))
{ {