[gdal-dev] TIFFFetchDirectory:Sanity check on directory count failed

Even Rouault even.rouault at spatialys.com
Thu Jul 8 10:17:09 PDT 2021


Hum, this error comes from deep in libtiff: 
https://github.com/OSGeo/gdal/blob/fec15b146f8a750c23c5e765cac12ed5fc9c2b85/gdal/frmts/gtiff/libtiff/tif_dirread.c#L4802

It would indicate that a TIFF directory (image) has more than 4096 tags, 
which is highly unlikely for a valid image. The error is in a source 
TIFF image. It shouldn't affect the *structure* of the output TIFF file. 
It might be an overview of the source image that is corrupted. So it 
could potentially affect the content of the overviews of the target 
file, but likely not, as GDAL will likely skip the corrupted source 
overview and regenerate it.

Le 08/07/2021 à 18:32, Matt.Wilkie at yukon.ca a écrit :
>
> Related to my previous question today, what is the nature of 
> “TIFFFetchDirectory:Sanity check on directory count failed” error?
>
> :: gdal_translate   -co compress=zstd   -co predictor=yes   -co 
> level=17   -co bigtiff=yes   -of cog   -a_nodata 0 
> Finlayson9488_SP7_08Aug2017_150cm.rgb-nir.vrt 
> out\Finlayson9488_SP7_08Aug2017_150cm.rgb-nir.tif
>
> Input file size is 41114, 22580
>
> 0...10...20ERROR 1: TIFFFetchDirectory:Sanity check on directory count 
> failed, this is probably not a valid IFD offset
>
> ERROR 1: TIFFReadDirectory:Failed to read directory at offset 16879620
>
> ...30...40...50...60...70...80...90...100 - done.
>
> The translate run finished successfully and `gdalinfo -mm …` reports 
> no errors on the output file structure. Visually the image appears 
> intact. (Is scanning for minmax the best way to test for a valid file? 
> I’ve been using it that way for years but maybe it’s not best practice.)
>
> *Matt Wilkie*
>
> Geomatics Developer & Administrator
>
> Environment | Technology, Innovation and Mapping
>
> T 867-667-8133 | _Yukon.ca <http://yukon.ca/>_
>
> /Hours: 08:30-16:30, Mon-Wed: Office, Thu: Remote, Fri: Away./
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
http://www.spatialys.com
My software is free, but my time generally not.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20210708/6b54d485/attachment.html>


More information about the gdal-dev mailing list