Replay: --dump handles code that was not recorded; shader code checked against shaders.bin before allocating #276

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

@⁠sharan104 on GitHub · 2026-11-26 14:04 UTC · original
sharan104:fix/replay-dump-missing-code → main · +71 −6 · 1 files · 1 commits · open

Two crashes in victory replay on captures it should handle:

  1. --dump on a pipeline whose code wasn't recorded. When the recorder can't write a shader, it numbers the code u32::MAX on purpose (record.rs). dump indexed frame.codes[blob] and panicked on such a capture, which the recorder itself produces.
  2. Code length from the file. dump, and the pipeline building in Player, sized a buffer straight from the code length stored in frame.bin. A wild length either panicked with a capacity overflow or aborted out of memory before the read could fail.

Fix:

  • dump writes <kind>=(not recorded) for a missing code and carries on with the pipeline's other parts.
  • A new helper, code(file, c), checks at + len against the size of shaders.bin (overflow included) before allocating. Both readers use it.

Test: shaders_are_dumped_from_what_the_capture_holds dumps a pipeline with one recorded code and one u32::MAX code. It gets 18=….dxil 23=(not recorded) and the right bytes. A length past the file, and one of u64::MAX, are both refused without allocating. The test panicked before the fix (index out of bounds) and passed 10 runs out of 10 after 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/276) `sharan104:fix/replay-dump-missing-code` → `main` · +71 −6 · 1 files · 1 commits · open Two crashes in `victory replay` on captures it should handle: 1. **`--dump` on a pipeline whose code wasn't recorded.** When the recorder can't write a shader, it numbers the code `u32::MAX` on purpose (`record.rs`). `dump` indexed `frame.codes[blob]` and panicked on such a capture, which the recorder itself produces. 2. **Code length from the file.** `dump`, and the pipeline building in `Player`, sized a buffer straight from the code length stored in `frame.bin`. A wild length either panicked with a capacity overflow or aborted out of memory before the read could fail. **Fix:** - `dump` writes `<kind>=(not recorded)` for a missing code and carries on with the pipeline's other parts. - A new helper, `code(file, c)`, checks `at + len` against the size of `shaders.bin` (overflow included) before allocating. Both readers use it. **Test:** `shaders_are_dumped_from_what_the_capture_holds` dumps a pipeline with one recorded code and one `u32::MAX` code. It gets `18=….dxil 23=(not recorded)` and the right bytes. A length past the file, and one of `u64::MAX`, are both refused without allocating. The test panicked before the fix (index out of bounds) and passed 10 runs out of 10 after 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)
When the recorder cannot write a shader to shaders.bin it numbers the code
u32::MAX ("shader code could not be written"), and the replay makes such a
pipeline without it. `victory replay --dump` indexed the codes with that
number and panicked on such a capture. It also made room for a code's
length straight from frame.bin, as did the replay's making of pipelines, so a
corrupt or truncated capture with a wild length panicked (capacity overflow)
or aborted out of memory instead of being refused. --dump now names a code
that is not there "(not recorded)" and goes on, and both read code through
`code`, which refuses a place past the end of shaders.bin before allocating.

Test: shaders_are_dumped_from_what_the_capture_holds (fails before the fix,
with the index out of bounds; 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:58 +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/276/head:github-bot/gh-276'
git switch 'github-bot/gh-276'

Merge

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