mirror of
https://gitlab.com/libtiff/libtiff.git
synced 2026-01-18 21:51:18 +01:00
Merge branch 'fix_ossfuzz_471328917' into 'master'
_TIFFGetStrileOffsetOrByteCountValue(): fix potential crash on corrupted files... See merge request libtiff/libtiff!799
This commit is contained in:
@@ -8344,6 +8344,20 @@ static uint64_t _TIFFGetStrileOffsetOrByteCountValue(TIFF *tif, uint32_t strile,
|
||||
TIFFDirectory *td = &tif->tif_dir;
|
||||
if (pbErr)
|
||||
*pbErr = 0;
|
||||
|
||||
/* Check that StripOffsets and StripByteCounts tags have the same number
|
||||
* of declared entries. Otherwise we might take the "dirent->tdir_count <=
|
||||
* 4" code path for one of them, and the other code path for the other one,
|
||||
* which will lead to inconsistencies and potential out-of-bounds reads.
|
||||
*/
|
||||
if (td->td_stripoffset_entry.tdir_count !=
|
||||
td->td_stripbytecount_entry.tdir_count)
|
||||
{
|
||||
if (pbErr)
|
||||
*pbErr = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((tif->tif_flags & TIFF_DEFERSTRILELOAD) &&
|
||||
!(tif->tif_flags & TIFF_CHOPPEDUPARRAYS))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user