A chunk header with nbytes 0 and no special type kept its declared block size (up to 512 MiB): the block size was clamped to nbytes only when nbytes was positive, and the scratch blocks were allocated before the (empty) block loop, so a 20-byte chunk allocated about 1 GiB. The block size is now clamped to nbytes always, and an empty chunk returns before any scratch is allocated. A frame chunk must also decode to the size the frame header gives it (chunksize, or the remainder for the last chunk), and is decoded with that as its limit, so an empty chunk in a frame for a non-empty HDF5 chunk is an error rather than an empty result. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
clawhdf5-format
Pure-Rust HDF5 binary format parsing and writing — no C dependencies.
Features
- Zero-copy superblock, object header, and B-tree parsing
- Chunked dataset read/write with filter pipelines
no_stdsupport (disablestdfeature)- Optional parallel reads via Rayon
- SHA-256 provenance tracking
Usage
use clawhdf5_format::Superblock;
let data = std::fs::read("data.h5").unwrap();
let sb = Superblock::from_bytes(&data).unwrap();
println!("HDF5 version {}.{}", sb.version_major(), sb.version_minor());
License
MIT