Mid-file NULs must not drop a CRC-valid suffix - #16
Merged
Conversation
Five NULs at a record boundary are treated as a torn tail after the B4 slack heuristic, so load() rewrites a CRC-valid suffix away. This fails on current main.
crc==0 && type==0 is trailing slack only when the rest of the file is zeros. A hole in front of a CRC-valid suffix is InvalidFormat so load() does not rewrite the suffix away.
Merged
jaredLunde
added a commit
that referenced
this pull request
Aug 16, 2026
* chore: bump to 0.7.3 — durability fixes since 0.7.2 Ship the four post-0.7.2 snapshot/watch fixes to crates.io: - #13 snapshot load must not drop a durable tail - #14 fsync parent directory after compact rename - #15 refuse watch resume at u64::MAX (no wrap to 0) - #16 mid-file NULs must not drop a CRC-valid suffix Also refresh README install snippets from 0.5 → 0.7. Co-authored-by: Jared Lunde <jared.lunde@gmail.com> * chore: sync Cargo.lock package version to 0.7.3 Co-authored-by: Jared Lunde <jared.lunde@gmail.com> --------- Co-authored-by: Cursor Agent <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The B4 slack heuristic treats
crc==0 && type==0as a torn tail. Five NULs between two CRC-valid records look like that, soload()compact-rewrites the suffix away. Two commits: a test that fails on main, then the fix.Truncated.InvalidFormatand does not rewrite the file.git checkout HEAD~1 && cargo test --test dst_invariants mid_file_nulsfails; HEAD passes.