Skip to content

rust future panicked: unknown error when opening TIFF files #97

Open
@maxrjones

Description

@maxrjones

Here is an MVCE for rust panics I encountered when building virtual_tiff. The TIFFs are from GDAL's test suite. You can change file_id to switch which TIFF is being opened.

import obstore as obs
from async_tiff import TIFF
from async_tiff.store import LocalStore
import os
import asyncio


# Set which file to run the test on
file_id = 0

# Download file
store = obs.store.HTTPStore.from_url("https://dagshub.com")

panics = [
    ("gdal_gcore", "huge-number-strips.tif"),
    ("gdal_gcore", "byte_user_defined_geokeys.tif"),
    ("gdal_gcore", "minimum_tiff_tags_no_warning.tif"),
    ("gdal_gcore", "uint16_sgilog.tif"),
    ("gdal_gcore", "corrupted_gtiff_tags.tif"),
    ("gdal_gcore", "gtiff_towgs84_override.tif"),
    ("gdal_gcore", "minimum_tiff_tags_with_warning.tif"),
    ("gdal_gcore", "bigtiff_header_extract.tif"),
    ("gdal_gcore", "spaf27_markedcorrect.tif"),
    ("gdal_gcore", "huge-implied-number-strips.tif"),
    ("gdal_gcore", "excessive-memory-TIFFFillStrip2.tif"),
    ("gdal_gcore", "packbits-not-enough-data.tif"),
    ("gdal_gcore", "excessive-memory-TIFFFillStrip.tif"),
    ("gdal_gcore", "byte_bigtiff_invalid_slong8_for_stripoffsets.tif"),
    ("gdal_gcore", "weird_mercator_2sp.tif"),
    ("gdal_gcore", "many_blocks_truncated.tif"),
    ("gdal_autotest", "epsg_27563_allgeokeys.tif"),
    ("gdal_autotest", "nodata_precision_issue_float32.tif"),
    ("gdal_autotest", "byte_coord_epoch.tif"),
    ("gdal_autotest", "projected_GTCitationGeoKey_with_underscore_and_GeogTOWGS84GeoKey.tif"),
    ("gdal_autotest", "nodata_precision_issue_float32.tif"),
    ("gdal_autotest", "missing_tilebytecounts_and_offsets.tif"),
]
path = f"maxrjones/virtual-tiff/raw/73934fbfb31cd5bb099f225a47ac8ea34298f3ea/tests/dvc/{panics[file_id][0]}/{panics[file_id][1]}"


resp = obs.get(store, path)
with open(panics[file_id][1], "wb") as f:
    for chunk in resp:
        f.write(chunk)

# Attempt to open file using async_tiff
async def open_tiff(*, store, path):
    return await TIFF.open(path, store=store)

store = LocalStore()
filepath = f"{os.getcwd()}/{panics[file_id][1]}"


tiff = asyncio.run(open_tiff(store=store, path=filepath))
print(tiff)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions