fix(format): lay Fixed/Extensible Array chunk indexes out by max dims

Both indexes place each chunk at a linear index computed from the
dataset's maximum dimensions (libhdf5's max_down_chunks), and the
Extensible Array first swizzles its unlimited dimension to the slowest
position. We linearised by the current dimensions, so any dataset whose
shape was smaller than its maxshape, or whose unlimited dimension was not
the first, read back scrambled without an error: h5py libver="latest"
files with maxshape (10, None) or (20, 10), and the libhdf5 test files
h5fc_ext*.h5 and test_ld.h5.

The linearisation now lives in chunk_grid (shared with the writers), and
slots beyond the current extent are ignored as the library does.
read_fixed_array_chunks / read_extensible_array_chunks take the
dataspace's max dimensions.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
osobh
2026-09-25 21:04:19 -05:00
co-authored by Claude Opus 5.5
parent 46203ea761
commit bba1560416
6 changed files with 546 additions and 174 deletions
@@ -593,6 +593,7 @@ pub fn list_chunks(
file_data,
&header,
&dataspace.dimensions,
dataspace.max_dimensions.as_deref(),
spatial_chunk_dims,
elem_size as u32,
offset_size,
@@ -608,6 +609,7 @@ pub fn list_chunks(
file_data,
&header,
&dataspace.dimensions,
dataspace.max_dimensions.as_deref(),
spatial_chunk_dims,
elem_size as u32,
offset_size,