Skip to content

Sealed length inflate past EOF must not drop the tail - #13

Open
paulocsanz wants to merge 3 commits into
beyondoss:mainfrom
paulocsanz:dst/b5-sealed-short-body
Open

Sealed length inflate past EOF must not drop the tail#13
paulocsanz wants to merge 3 commits into
beyondoss:mainfrom
paulocsanz:dst/b5-sealed-short-body

Conversation

@paulocsanz

Copy link
Copy Markdown
Contributor

#11 fail-stops on a fully-framed mid-file CRC. Inflating val_size so the record does not fit never reaches CRC; scan_sealed / rebuild_from_records treated that as a torn tail and returned the prefix.

Two commits: a test that fails on main, then fail-stop (CrcMismatch). A short header at EOF is still a torn tail.

git checkout HEAD~1 && cargo test -p beyond-kv-engine --lib sealed_inflated fails; HEAD passes.

Inflating val_size so the record does not fit never reaches CRC. scan_sealed used to return the prefix. This fails on current main.
A complete header that claims a body bigger than the file is bitrot of the CRC'd length fields, not a torn tail. scan_sealed and rebuild_from_records now CrcMismatch instead of returning a silent prefix.
A complete header whose body never landed is a torn tail. Fail-stop
only when a later CRC-ok record is still in the file (mid-file val_size
inflate). Restores torn_footer_falls_back_to_scan_across_files.
@paulocsanz

Copy link
Copy Markdown
Contributor Author

CI red was two things:

  1. lint — dprint wanted the new encode_into wrapped.
  2. rust-testtorn_footer_falls_back_to_scan_across_files cuts into the last record. A complete header + short body at EOF is a torn last write, not bitrot. The first cut treated every past-EOF length as CrcMismatch.

The distinguisher is now: fail-stop only when a later CRC-ok record still sits in the file (the mid-file val_size inflate). A torn last record stays a prefix. Added sealed_incomplete_last_record_is_torn_tail so that contract cannot regress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant