format: chunk grids with a zero extent have no chunks (no division by zero)

A Fixed or Extensible Array index whose maximum extent (the current one
when no maximum is recorded) is 0 along a dimension has a zero stride for
every dimension before it; ChunkGrid::offsets divided by it. The unfixed
editor made such files by resizing a clawhdf5-written dataset to a zero
extent: `h5rs check` panicked and the next resize raised an internal
error (12 of the reviewer's random-edit seeds 10..39). Such an index has
no slot for any chunk of the dataset; offsets now returns None.

Tests: chunk_grid::zero_extent_has_no_chunks; edit_interop's
zero_extent_resizes_without_a_recorded_maximum on a file the unfixed
editor left (fixture) and on a 2.7.0-written file taken through zero
extents with `h5rs check --data` and h5dump at every step; test_edit.py
random edits on seeds 10..39 of a clawhdf5-written file.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
osobh
2026-09-27 07:40:11 -05:00
co-authored by Claude Opus 5.5
parent 1f7651644b
commit bdf584abb2
5 changed files with 116 additions and 0 deletions
+16
View File
@@ -2,6 +2,22 @@
## Unreleased
### Correctness: zero extents in Fixed/Extensible Array chunk indexes (2026-09-27)
- **A chunked dataset whose maximum (or, with none recorded, current)
extent is 0 along a dimension made the reader divide by zero** (fixed
2026-09-27): `h5rs check` panicked ("attempt to divide by zero",
`chunk_grid.rs`) and the next `FileEditor::resize` failed with an
internal error. The unfixed editor produced such files by resizing a
clawhdf5-written dataset to a zero extent (12 of 30 extra random-edit
seeds on clawhdf5-written files). Such an index has no slot for any
chunk of the dataset, and `ChunkGrid::offsets` now says so instead of
dividing by the zero stride. Tests: `chunk_grid`'s
`zero_extent_has_no_chunks`, `edit_interop.rs`'s
`zero_extent_resizes_without_a_recorded_maximum` (a file the unfixed
editor left checks clean and resizes on; a 2.7.0-written file through
zero extents checks clean at each step), and `test_edit.py`'s random
edits on seeds 10 to 39 of a clawhdf5-written file.
### Correctness: resizing chunked datasets with no recorded maximum (2026-09-27)
- **`FileEditor::resize` scrambled the values of a chunked dataset whose
dataspace records no maximum dimensions when it shrank it** (fixed