TIFFReadCustomDirectory(): fix potential heap buffer overflow when reading a custom directory, after a regular directory where a codec was active. Fixes https://gitlab.com/libtiff/libtiff/issues/178

This commit is contained in:
Even Rouault 2020-03-01 22:22:01 +01:00
parent 18ca4b4276
commit 25b274126d
No known key found for this signature in database
GPG Key ID: 33EBBFC47B3DD87D

View File

@ -4441,6 +4441,7 @@ TIFFReadCustomDirectory(TIFF* tif, toff_t diroff,
uint16 di;
const TIFFField* fip;
uint32 fii;
(*tif->tif_cleanup)(tif); /* cleanup any previous compression state */
_TIFFSetupFields(tif, infoarray);
dircount=TIFFFetchDirectory(tif,diroff,&dir,NULL);
if (!dircount)