Skip to content

LZW decompression fails for GeoTIFFs written by SNAP (Sentinel Application Platform) due to dictionary buffer size (4093 vs 4096?) #545

Description

@Shivamk034

Hi,

We've encountered an issue while reading GeoTIFF files generated by SNAP.
The files use LZW compression, but geotiff fails to decompress them, while other software (e.g. SNAP and GDAL) can read them without any issues.

After debugging, it appears the problem may be related to the LZW dictionary buffer size. From investigation:

  • The GeoTIFFs written by SNAP seem to require a dictionary size of 4096 entries.
  • The current implementation in geotiff appears to be limited to 4093 entries (or otherwise stops growing the dictionary before reaching 4096).
  • This causes decompression to fail for these files.

Questions:

  • Is the current dictionary size intentionally limited to 4093?
  • Is there a reason it doesn't allow the full 4096 entries defined by the LZW specification?
  • Could this be the cause of the incompatibility with GeoTIFFs produced by SNAP?
  • If this is a bug, would you be open to a fix?

Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions