EstimateStripByteCounts(): avoid unsigned integer overflow. Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=16643&
This commit is contained in:
parent
5f6349d3f8
commit
ea271d7434
@ -4590,8 +4590,12 @@ EstimateStripByteCounts(TIFF* tif, TIFFDirEntry* dir, uint16 dircount)
|
||||
uint64 rowbytes = TIFFScanlineSize64(tif);
|
||||
uint32 rowsperstrip = td->td_imagelength/td->td_stripsperimage;
|
||||
for (strip = 0; strip < td->td_nstrips; strip++)
|
||||
{
|
||||
if( rowbytes > 0 && rowsperstrip > TIFF_UINT64_MAX / rowbytes )
|
||||
return -1;
|
||||
td->td_stripbytecount_p[strip] = rowbytes * rowsperstrip;
|
||||
}
|
||||
}
|
||||
TIFFSetFieldBit(tif, FIELD_STRIPBYTECOUNTS);
|
||||
if (!TIFFFieldSet(tif, FIELD_ROWSPERSTRIP))
|
||||
td->td_rowsperstrip = td->td_imagelength;
|
||||
|
Loading…
Reference in New Issue
Block a user