replay: --listing checks the list a capture names #641
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
hle
input
INTEL
lighting
linux-proton
memory
MULDER
needs-info
needs-logs
needs-rebase
NVIDIA
performance
post-merge
pr-diagnostics
pr-docs
pre-merge
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
relevance
high
relevance
low
relevance
medium
relevance
very-high
rendering
report
roadmap-proposal
saves
series-s
shaders
startup
status
blocked-by-rework
status
needs-test-report
status
needs-triage
status
ready-for-review
status
stale
status
superseded
status
wip
tools
ui
upstream
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
TrustNo1/Darner!641
Loading…
Reference in a new issue
No description provided.
Delete branch "qnjk/Darner:replay-listing-bounds"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Contributor role (optional)
What it changes
The problem on main:
--listingwalked a submission's list ids and indexed the capture's list table with each one:(
crates/darner-gpu/src/replay/play.rs). The id is read from the sameframe.binas the table, and a capture is a file someone else may have written: the recorder can leave a submission naming a list it never wrote out, and a bit-flipped or truncatedframe.bincan name any number at all. Such a capture made--listingpanic with an index out of bounds instead of answering with the command's usualErr. The player's own path through the table already refuses it (self.commands.get), and--dumpnow reads its own table the same way (#602, merged).This change looks the id up with
frame.lists.get(l as usize)and answersanyhow!("the capture has no list {l}"), so the tool reports the bad reference instead of aborting.How it was tested
10dcfe6(one commit onc8258f9).cargo test --locked -p darner-gpu --features diagnostics --lib -- replay— 34 passed, 0 failed, 1 ignored.a_capture_that_names_no_list_is_refused: a syntheticframe.binbuilt throughFrame::write(one submission naming list 0 of an empty list table), no GPU and no title. Before this change it panicked withindex out of bounds: the len is 0 but the index is 0; now it is anErrnaming the list.cargo clippy --locked -p darner-gpu --all-targets --features diagnostics -- -D warningspasses.cargo clippy --workspace --all-targets --locked -- -D warnings: passes.cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: passes.replaytests are green; the whole-workspace run is not green on this machine for the pre-existingdarner-gpureasons (#224, #150), which this does not touch.Cmd::all, which has its own parser and was not reviewed here.Checklist
darner replay --listingis an offline tool; the evidence is the test, which panics onmain.main.docs/asset-policy.md(cargo xtask policy: passes).Checked for overlap
crates/darner-gpu/src/replay/play.rs; neither mentions--listingor the list table. No open or closed issue mentions it either.`listing` (`darner replay <capture> --listing <range>`) walked a submission's list ids and indexed the capture's list table with each one: `Cmd::all(&frame.lists[l as usize].commands.0)`. Both numbers are the capture's own, read from the same `frame.bin`, and a capture is a folder on disk (9 GB for a title's frame, `docs/replay.md:42`): a copy, a bit flip or an editor can leave one that disagrees with itself, because the wire format checks lengths and never that a submission names a list the table holds. Such a capture made `--listing` panic with an index out of bounds, where the rest of the command answers with an `Err` for a capture it cannot use. The player's own path through the table already refuses it (`self.commands.get(l as usize)`), and `--dump` had the same unchecked class in its own table. The id is now looked up with `frame.lists.get(l as usize)` and answered with `anyhow!("the capture has no list {l}")`, so the command reports the bad reference rather than aborting the process. `a_capture_that_names_no_list_is_refused` pins it with a synthetic `frame.bin` built through `Frame::write` (one submission naming list 0 of an empty list table), no GPU and no title: before this change it panicked with "index out of bounds: the len is 0 but the index is 0".[pr-fix] replay: --listing checks the list a capture namesto replay: --listing checks the list a capture namesView command line instructions
Checkout
From your project repository, check out a new branch and test the changes.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.