The version-1 chunk walk nested continuation chunks depth-first and kept every enclosing chunk's buffer alive, up to 65 536 chunks. With storage that hands out owned buffers (CountingStorage, the Storage trait, remote storage) a crafted chain of chunks nested in each other read and held the square of the file's size (a 192 KB file read 768 MB). Chunks are now read from a FIFO queue of (address, length) pairs in the order their continuation messages are found, as H5O_protect does and as the editor's header walker already did, each buffer released before the next read. In both header versions a chunk starting at an address seen before (cycle) is refused, and so are chunks adding up to more than the file, which bounds a header's reads by the file's size. Overlap itself is allowed: libhdf5 reads cve-2025-7067.h5, whose continuation chunk overlaps chunk 0 (refusing overlap cost that conformance file). Tests: the nested chain is refused having read at most the file (it read n^2 bytes before); a 3000-chunk chain reads each chunk once; a chunk's messages follow the whole previous chunk (they were inserted at the continuation message); an overlapping continuation chunk is read. 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