Add geotiff edge-case tests: IFD loops, header parsing, descending-y, non-georeferenced (#1482)#1492
Merged
brendancol merged 1 commit intomainfrom May 5, 2026
Merged
Add geotiff edge-case tests: IFD loops, header parsing, descending-y, non-georeferenced (#1482)#1492brendancol merged 1 commit intomainfrom
brendancol merged 1 commit intomainfrom
Conversation
2 tasks
brendancol
added a commit
that referenced
this pull request
May 5, 2026
…1495) test_merge_dask_different_crs_matches_eager intermittently SIGABRTs on macOS CI runners. The merge() dask graph creates a fresh pyproj.Transformer per chunk, and PROJ's first-time CRS-database load is not safe under concurrent threaded workers — multiple threads racing to init the SQLite DB on macOS triggers an abort. The test exercises dask graph correctness, not dask threading. Pin it to the synchronous scheduler and pre-warm pyproj.CRS objects so the parity assertion runs without the threading dimension. CRS thread-safety in the production reproject path is its own concern and is not regressed here. Refs the same crash on PR #1492 macOS-3.13 and on main run e253900 (macOS-3.12).
Tests: - IFD chain loop / cycle detection in parse_all_ifds - RATIONAL/SRATIONAL with denominator=0 returning 0.0 - RATIONAL with count overflowing the buffer - Truncated IFD entry buffer - BigTIFF malformations (offset_size != 8, truncated header) - Classic TIFF first-IFD offset past buffer - Descending-y (south-up) write/read round-trip - Non-georeferenced TIFF read produces integer pixel coords Code: - _extract_transform now returns (transform, has_georef) so callers can tell "no GeoTIFF tags" apart from "tags present with default values". GeoInfo carries the new has_georef flag. - _geo_to_coords falls back to integer pixel coords (0..N-1) when has_georef is False, instead of producing y values like -0.5, -1.5, ... from the default unit transform.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1482.
Summary
21 new tests in the geotiff module, plus one small reader fix.
Tests cover:
parse_all_ifdsalready had aseenset; this adds a test that builds a malicious buffer where IFD2 points back at IFD1, so the guard can't regress silently._read_valueedge cases: RATIONAL/SRATIONAL with denominator zero, RATIONAL count overflow, truncated IFD entry buffer.offset_size != 8, truncated 8-byte BigTIFF header.crsattr, instead of fractional coords from the default unit transform.Code change
_extract_transformnow returns(transform, has_georef).GeoInfocarries a newhas_georefflag._geo_to_coordsfalls back to integer pixel coords whenhas_georefis False. Existing georeferenced reads behave identically.Test plan
pytest xrspatial/geotiff/tests/test_header.py xrspatial/geotiff/tests/test_georef_edges.pytest_features.py::TestPaletteare unrelated and present onmain.