Replay: refuse a capture whose submissions name lists it does not hold (indexed out of bounds) #275

Open
github-bot wants to merge 1 commit from github-bot/gh-275 into main AGit
Owner

@⁠sharan104 on GitHub · 2026-11-26 14:04 UTC · original
sharan104:fix/replay-read-bounds → main · +42 −0 · 1 files · 1 commits · open

Frame::read (replay/wire.rs) took a submission's list numbers as they came. The callers then index frame.lists directly:

  • listing (play.rs)
  • look::flow
  • the replay itself, including diverge.rs

So a corrupt or truncated frame.bin naming a list past the end made victory replay panic with an index out of bounds, instead of refusing the file the way Frame::read already does for other bad data.

Fix: Frame::read refuses any list number that is neither MISSING nor inside lists, with Bad("a submission of a list it does not hold"). The recorder only ever writes those two kinds, so captures it made still load.

Test: a_submission_of_a_list_not_there_is_refused writes a frame whose submission names [0, MISSING], which still reads, and one naming [0, 1] with a single list, which is refused. It fails with the check removed, and passed 10 runs out of 10 with it.

Results:

  • Tests with --features diagnostics pass.
  • Clippy -D warnings adds nothing beyond main's existing watch.rs lint, which #241 fixes.

🤖 Generated with Claude Code

**@⁠sharan104** on GitHub · 2026-11-26 14:04 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/pull/275) `sharan104:fix/replay-read-bounds` → `main` · +42 −0 · 1 files · 1 commits · open `Frame::read` (`replay/wire.rs`) took a submission's list numbers as they came. The callers then index `frame.lists` directly: - `listing` (`play.rs`) - `look::flow` - the replay itself, including `diverge.rs` So a corrupt or truncated `frame.bin` naming a list past the end made `victory replay` panic with an index out of bounds, instead of refusing the file the way `Frame::read` already does for other bad data. **Fix:** `Frame::read` refuses any list number that is neither `MISSING` nor inside `lists`, with `Bad("a submission of a list it does not hold")`. The recorder only ever writes those two kinds, so captures it made still load. **Test:** `a_submission_of_a_list_not_there_is_refused` writes a frame whose submission names `[0, MISSING]`, which still reads, and one naming `[0, 1]` with a single list, which is refused. It fails with the check removed, and passed 10 runs out of 10 with it. **Results:** - Tests with `--features diagnostics` pass. - Clippy `-D warnings` adds nothing beyond main's existing `watch.rs` lint, which #241 fixes. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
A submission's lists are numbers that the listing, --flow and the replay use
as places in the frame's lists (`frame.lists[l]`, `commands[l]`), with only
MISSING left out. Frame::read checked the magic, the version and the length,
but not these numbers, so a truncated or corrupt frame.bin, or one from
another build, with a list number past the lists panicked the tool with an
index out of bounds instead of saying the capture cannot be read. The
recorder only writes numbers of lists it wrote, or MISSING, so a capture it
made is never refused. Frame::read now refuses any other number.

Test: a_submission_of_a_list_not_there_is_refused (fails before the fix,
passes after).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 14:06:56 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/275/head:github-bot/gh-275'
git switch 'github-bot/gh-275'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-275'
git switch 'github-bot/gh-275'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-275'
git switch 'github-bot/gh-275'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-275'
git switch 'main'
git merge --squash 'github-bot/gh-275'
git switch 'main'
git merge --ff-only 'github-bot/gh-275'
git switch 'main'
git merge 'github-bot/gh-275'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.