Check pipeline stream subobject bounds #1524
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!1524
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-1524"
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?
@Gauss999 on GitHub · 2026-11-28 21:14 UTC · original
Gauss999:patch-2→main· +93 −5 · 1 files · 2 commits · merged 2026-11-29 08:16 UTCSummary
keep.lostand stop before reading outsideSizeInBytes.Tests
No local build or tests were run. CI depends on maintainer approval; no CI results are available yet.
@babuakhil on GitHub · 2026-11-28 22:09 UTC · original
Built and ran this on Windows, since it hadn't been run yet: Windows 11, Rust 1.98.1 (pinned), applied on current
main(d4b5d51); cherry-picks cleanly. Clippy reports nothing inpso.rs.Heads-up for CI:
replayis#[cfg(all(windows, feature = "diagnostics"))], so these tests only build with--features diagnostics. CI'scargo test --workspace --lockedruns without it and won't run them. With the feature, all threereplay::psotests pass.The out-of-bounds read is real and fixed. I fed
streama few hand-made streams from a throwaway test (not part of this PR):mainSizeInBytes = 4(payload past the end)5)DXGI_SAMPLE_DESC),SizeInBytes = 16SizeInBytes = 12(complete, no trailing padding)SizeInBytes = 20(last one complete, unpadded)One problem: the last two rows.
subobject_boundsrequires the aligned end (next) to fit, so a last subobject whose payload ends on a 4-byte boundary (DXGI_SAMPLE_DESC;D3D12_BLEND_DESCandDEPTH_STENCIL_DESC1end the same way) is dropped whenSizeInBytesdoesn't include the trailing pad, although every byte read is inside the stream. Streams built from d3dx12-stylealignas(void*)subobjects are padded, so this may never happen with the title's streams, but it is a change frommainbeyond the bounds fix.Checking the payload's end and using
nextonly to advance keeps the fix and accepts those:The loop's
at + 4 <= SizeInBytescheck already ends the walk whennextruns past the end.subobject_bounds(0, 4, 4, 7)staysNone(the payload ends at 8), and the overflow cases still returnNonefrom thechecked_adds.@Gauss999 on GitHub · 2026-11-28 22:45 UTC · original
Thanks @babuakhil for validating this on Windows and catching the unpadded-final-subobject regression.
subobject_boundsnow computesvalueandendwith checked arithmetic and checks onlyend <= stream_size. The alignednextcalculation also remains checked, butnextmay extend past the stream and is used only for advancement; the existing loop condition ends the walk before another read.I added a decoding regression for a final kind 17 /
DXGI_SAMPLE_DESCwithSizeInBytes = 12: its complete 8-byte payload is accepted without trailing padding and decoded with no loss reported. The bounds regression also checks(value, next) == (4, 16)for that case, while the truncated-payload case and all payload/alignment overflow cases still returnNone.I reviewed the resulting diff; only
crates/victory-gpu/src/replay/pso.rschanged. I have not run the Windows-only tests locally.@babuakhil on GitHub · 2026-11-28 23:04 UTC · original
Re-checked with
b53b952ond4b5d51(Windows 11, Rust 1.98.1): builds, clippy (--all-features) reports nothing inpso.rs, and with--features diagnosticsall fourreplay::psotests pass,a_complete_unpadded_final_subobject_is_takenamong them (27/27replaytests).The same throwaway streams as before now give:
fad0e0b)SizeInBytes = 4SizeInBytes = 16SizeInBytes = 12SizeInBytes = 20So the out-of-bounds read stays fixed, and the unpadded final subobjects are taken again. Looks good to me.