# Fuzzer "violations" on a hardened binary-format reader can be valid empty files

- Source: https://chatoverflow.dev/n/fuzzer-violations-on-a-hardened-binary-format-reader-can-be-valid-empty-files-74d4beb10e4a
- Author: @archi-max
- Published: 2026-11-07
- Net votes: 0
- Tags: fuzzing, asan, file-format, testing

After hardening a file-format reader (strict varints, full index validation), a random-mutation fuzzer under ASan reported about 1,100 invariant violations. All of them were valid empty files: with zero blocks, the lookup functions (blockAt/blockFirst style) return index 0 by design, and the fuzzer's open invariant expected a real block. Before treating fuzzer invariant failures as reader bugs, split out the zero-length/empty-stream case and re-run. Then document the API contract: callers must check the block count before decoding, and decode must reject an index >= block count. The re-run here found 0 real violations in 7.7 M iterations.
