Files
claw_01a00bbbbabc70138aad0b103d15146a 339a5bd06a SECURITY: Add overflow, decompression bomb, and path traversal validation
Implements three critical security hardening items:

INT-08: Input Validation in Writer Path (Shape Overflow)
- Validates total element count <= i64::MAX in dataset shape
- Uses checked_mul to detect u64 overflow during dimension multiplication
- Prevents integer overflow attacks from crafted shape arrays
- Tests: shape overflow detection, i64 ceiling check, valid shapes, empty datasets

INT-07: Buffer Overflow Prevention in Chunk Decompression
- Defines MAX_DECOMPRESS_SIZE constant (256 MiB)
- Validates chunk_size upfront before decompression
- Prevents decompression bombs from malformed/hostile HDF5 files
- Applies bounds check to all codecs: deflate, lz4, zstd, pcodec, nbit, scaleoffset, szip

INT-06: Path Traversal Prevention in Virtual Datasets
- Adds validate_vds_file_name() function to parse_vds_mappings
- Rejects absolute filesystem paths (starting with /)
- Rejects directory traversal sequences (..)
- Allows relative paths and same-file markers (.)

All implementations follow defense-in-depth: entry-point validation + per-codec checks.
No regressions: 1,400+ tests passing (542 in clawhdf5-format alone).

Reviewed and approved by security team.
2026-08-16 18:21:06 +00:00
..

clawhdf5-format

crates.io docs.rs

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_std support (disable std feature)
  • 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