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

Open
sharan104 wants to merge 1 commit from upstream-pr/276 into main
sharan104 commented 2026-11-26 14:04:27 +00:00 (Migrated from github.com)

Imported from avatarmanz/VIctory-7900XTX. Originally posted by sharan104 on 2026-11-26T14:04:27Z.


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

<!-- greyfinch-sync:avatarmanz/VIctory-7900XTX:issue:6628338969 --> Imported from [avatarmanz/VIctory-7900XTX](https://github.com/avatarmanz/VIctory-7900XTX/pull/276). Originally posted by [sharan104](https://github.com/sharan104) on 2026-11-26T14:04:27Z. --- 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)
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/276:upstream-pr/276'
git switch 'upstream-pr/276'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/276'
git switch 'upstream-pr/276'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/276'
git switch 'upstream-pr/276'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/276'
git switch 'main'
git merge --squash 'upstream-pr/276'
git switch 'main'
git merge --ff-only 'upstream-pr/276'
git switch 'main'
git merge 'upstream-pr/276'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
avatarmanz/VIctory-7900XTX!276
No description provided.