[gdal-dev] "gdaladdo: tif_dirwrite.c:2449: TIFFWriteDirectoryTagData: Assertion `datalength<0x80000000UL' failed."

Even Rouault even.rouault at spatialys.com
Thu Jan 23 05:21:19 PST 2020


> I'm trying to build overviews on a large vrt file, but I'm getting the > 
following error message
>"gdaladdo: tif_dirwrite.c:2449: TIFFWriteDirectoryTagData: Assertion > 
`datalength<0x80000000UL' failed."

Ouch, you hit a bug in libtiff. What you are trying to create is an absolutely 
large BigTIFF file.

Given 128x128 tiles and your raster dimensions, the size of each of the 
TileByteCount/TileOffset TIFF array would be

(3812500 / 128.) * (8203125 / 128.) * sizeof(double) = 15.2 GB !

For tag data, libtiff has a limitation to 2 GB (this is a - reasonable - 
implementation limitation, the format itself could allow to 2^63). Ideally, it 
should have rejected from the start this attempt instead of crashing. You may 
want to file a ticket about that.

You can add --config GDAL_TIFF_OVR_BLOCKSIZE 1024 (or a larger value) to 
increase the size of overview tiles, and thus reduce the size of each array to 
a more reasonable ~ 230 MB.


Spatialys - Geospatial professional services

More information about the gdal-dev mailing list