Fix wrong file size checks for memory-mapped BigTIFF files that could lead to image rejection
This commit is contained in:
parent
632f6a1a4f
commit
c51400048e
@ -864,7 +864,7 @@ static enum TIFFReadDirEntryErr TIFFReadDirEntryArrayWithLimit(
|
|||||||
datasize=(*count)*typesize;
|
datasize=(*count)*typesize;
|
||||||
assert((tmsize_t)datasize>0);
|
assert((tmsize_t)datasize>0);
|
||||||
|
|
||||||
if( isMapped(tif) && datasize > (uint32)tif->tif_size )
|
if( isMapped(tif) && datasize > (uint64)tif->tif_size )
|
||||||
return TIFFReadDirEntryErrIo;
|
return TIFFReadDirEntryErrIo;
|
||||||
|
|
||||||
if( !isMapped(tif) &&
|
if( !isMapped(tif) &&
|
||||||
@ -3400,7 +3400,7 @@ TIFFReadDirEntryData(TIFF* tif, uint64 offset, tmsize_t size, void* dest)
|
|||||||
return TIFFReadDirEntryErrIo;
|
return TIFFReadDirEntryErrIo;
|
||||||
}
|
}
|
||||||
mb=ma+size;
|
mb=ma+size;
|
||||||
if (mb > (size_t)tif->tif_size)
|
if (mb > (uint64)tif->tif_size)
|
||||||
return(TIFFReadDirEntryErrIo);
|
return(TIFFReadDirEntryErrIo);
|
||||||
_TIFFmemcpy(dest,tif->tif_base+ma,size);
|
_TIFFmemcpy(dest,tif->tif_base+ma,size);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user