Opened 6 years ago

Closed 6 years ago

#7158 closed defect (invalid)

TIFFFetchDirectory Can not read TIFF directory count

Reported by: winsent Owned by: warmerdam
Priority: normal Milestone:
Component: default Version: unspecified
Severity: normal Keywords: libtiff
Cc:

Description

gdalinfo result with error:

ERROR 1: TIFFFetchDirectory:/map/test.tif: Can not read TIFF directory count
ERROR 1: TIFFReadDirectory:Failed to read directory at offset 9372747494

Tested on GDAL 2.2.1 with internal and 2.2.2 external libbtiff

gdalinfo --debug on /map/test.tif

GDAL: Auto register /usr/local/lib/gdalplugins/2.2/gdal_ECW_JP2ECW.dylib using GDALRegister_ECW_JP2ECW.
GNM: GNMRegisterAllInternal
GNM: RegisterGNMFile
GNM: RegisterGNMdatabase
GDAL: GDALOpen(/map/test.tif, this=0x7fcaf7c2fcd0) succeeds as GTiff.
Driver: GTiff/GeoTIFF
GDAL: GDALDefaultOverviews::OverviewScan()
Files: /map/test.tif
       /map/test.tif.aux.xml
Size is 72425, 39130
GTiff: Got COMPD_CS, but stripping it.
Coordinate System is:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0],
    UNIT["degree",0.0174532925199433],
    AUTHORITY["EPSG","4326"]]
Origin = (47.614297634518373,55.469304077884630)
Pixel Size = (0.000000540924000,-0.000000307332000)
Metadata:
  AREA_OR_POINT=Area
Image Structure Metadata:
  COMPRESSION=LZW
  INTERLEAVE=PIXEL
GTiff: ScanDirectories()
ERROR 1: TIFFFetchDirectory:/map/test.tif: Can not read TIFF directory count
ERROR 1: TIFFReadDirectory:Failed to read directory at offset 9372747494
OGRCT: PROJ >= 4.8.0 features enabled
OGRCT: Using locale-safe proj version
OGRCT: Source: +proj=longlat +datum=WGS84 +no_defs
OGRCT: Target: +proj=longlat +datum=WGS84 +no_defs
Corner Coordinates:
Upper Left  (  47.6142976,  55.4693041) ( 47d36'51.47"E, 55d28' 9.49"N)
Lower Left  (  47.6142976,  55.4572782) ( 47d36'51.47"E, 55d27'26.20"N)
Upper Right (  47.6534741,  55.4693041) ( 47d39'12.51"E, 55d28' 9.49"N)
Lower Right (  47.6534741,  55.4572782) ( 47d39'12.51"E, 55d27'26.20"N)
Center      (  47.6338858,  55.4632911) ( 47d38' 1.99"E, 55d27'47.85"N)
Band 1 Block=256x256 Type=Byte, ColorInterp=Red
  Min=0.000 Max=255.000
  Minimum=0.000, Maximum=255.000, Mean=74.401, StdDev=55.246
  Mask Flags: PER_DATASET ALPHA
  Unit Type: metre
  Metadata:
    STATISTICS_MAXIMUM=255
    STATISTICS_MEAN=74.400727716336
    STATISTICS_MINIMUM=0
    STATISTICS_STDDEV=55.24572542782
Band 2 Block=256x256 Type=Byte, ColorInterp=Green
  Min=0.000 Max=255.000
  Minimum=0.000, Maximum=255.000, Mean=77.548, StdDev=54.362
  Mask Flags: PER_DATASET ALPHA
  Unit Type: metre
  Metadata:
    STATISTICS_MAXIMUM=255
    STATISTICS_MEAN=77.548411021527
    STATISTICS_MINIMUM=0
    STATISTICS_STDDEV=54.362085866807
Band 3 Block=256x256 Type=Byte, ColorInterp=Blue
  Min=0.000 Max=255.000
  Minimum=0.000, Maximum=255.000, Mean=59.497, StdDev=43.029
  Mask Flags: PER_DATASET ALPHA
  Unit Type: metre
  Metadata:
    STATISTICS_MAXIMUM=255
    STATISTICS_MEAN=59.497316214126
    STATISTICS_MINIMUM=0
    STATISTICS_STDDEV=43.028982283604
Band 4 Block=256x256 Type=Byte, ColorInterp=Alpha
  Min=0.000 Max=255.000
  Minimum=0.000, Maximum=255.000, Mean=188.266, StdDev=112.088
  Unit Type: metre
  Metadata:
    STATISTICS_MAXIMUM=255
    STATISTICS_MEAN=188.26583320285
    STATISTICS_MINIMUM=0
    STATISTICS_STDDEV=112.0881952534
GDAL: GDALClose(/map/test.tif, this=0x7fcaf7c2fcd0)

Change History (6)

comment:1 by winsent, 6 years ago

tiffdump result

tiffdump /map/test.tif

Magic: 0x4949 <little-endian> Version: 0x2b <BigTIFF>
OffsetSize: 0x8 Unused: 0
Directory 0: offset 7511681930 (0x1bfbb2b8a) next 9372747494 (0x22ea8c6e6)
ImageWidth (256) LONG (4) 1<72425>
ImageLength (257) SHORT (3) 1<39130>
BitsPerSample (258) SHORT (3) 4<8 8 8 8>
Compression (259) SHORT (3) 1<5>
Photometric (262) SHORT (3) 1<2>
SamplesPerPixel (277) SHORT (3) 1<4>
PlanarConfig (284) SHORT (3) 1<1>
TileWidth (322) SHORT (3) 1<256>
TileLength (323) SHORT (3) 1<256>
TileOffsets (324) LONG8 (16) 43299<16 892 1768 2644 3520 4396 5272 6148 10546 43160 108227 205259 335134 499218 694451 926208 53382755 53569445 53700707 53776373 53798973 53799849 53800725 53801601 ...>
TileByteCounts (325) LONG8 (16) 43299<876 876 876 876 876 876 876 4398 32614 65067 97032 129875 164084 195233 231757 239010 186690 131262 75666 22600 876 876 876 876 ...>
ExtraSamples (338) SHORT (3) 1<2>
SampleFormat (339) SHORT (3) 4<1 1 1 1>
33550 (0x830e) DOUBLE (12) 3<5.40924e-07 3.07332e-07 0>
33922 (0x8482) DOUBLE (12) 6<0 0 0 47.6143 55.4693 0>
34735 (0x87af) SHORT (3) 56<1 1 0 13 1024 0 1 2 1025 0 1 1 2048 0 1 4326 2049 34737 7 0 2050 0 1 6326 ...>
34736 (0x87b0) DOUBLE (12) 4<0.0174533 6.37814e+06 298.257 0>
34737 (0x87b1) ASCII (2) 8<WGS 84|\0>

comment:2 by winsent, 6 years ago

Summary: Can not read TIFF directory countTIFFFetchDirectory Can not read TIFF directory count

comment:3 by Even Rouault, 6 years ago

Is it really an issue of GDAL / libtiff ? tiffdump shows that there would be a directory at offset 9372747494, but in the tiffdump output you show it doesn't display it, so it looks like it would be missing. Is your file correct ? It looks like it might be truncated

comment:4 by winsent, 6 years ago

I will continue to find how this could happen. Overview added end removed with gdaladdo Could you in this task, tell how i can check the tiff file and raise exception if it happened?

comment:5 by Even Rouault, 6 years ago

how i can check the tiff file

ls -al /map/test.tif

comment:6 by Even Rouault, 6 years ago

Resolution: invalid
Status: newclosed

Closing due to lack of feedback from reporter. Reopen if you've more elements

Note: See TracTickets for help on using tickets.