2015.04.02 20:22 "[Tiff] problem reading directories past 2GB on a 64bits system", by Romain Franconville

2015.04.03 01:59 "Re: [Tiff] problem reading directories past 2GB on a 64bits system", by Bob Friesenhahn

I'm using libtiff 4.0-3 on Ubuntu (64bits) 14.04.

I'm trying to read tiff files that are signed 16bits. Everything run smoothly for files smaller than 2Gb. But I cannot access directories past that limit.

TIFFSetDirectory returns the following error in those cases:

     TIFFFetchDirectory: Sanity check on directory count failed, zero tag
directories not supported.
Failed to read directory at offset 256.      TIFFReadDirectory:

Opening as bigtiff doesn't make a difference (expected since it's still less than 4Gb).

> Any ideas of what might be going on ? 

Now that I am looking at the code, I see that the directory count is expected to fit in a 16-bit storage size. Is it possible that you have more than 64k entries?

This is the relevant code (after passing several other checks):

                        dircount16 = (uint16)dircount64;
                        dirsize = 20;
                }
                if (dircount16 == 0 )
                {
                        TIFFErrorExt(tif->tif_clientdata, module,
                                     "Sanity check on directory count failed, zero tag directories not supported");
                        return 0;
                }

Bob
--
Bob Friesenhahn
bfriesen@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer, http://www.GraphicsMagick.org/