loader/crash: prevent RSP overflow and unaligned read UB in unwind_into #791
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!791
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-791"
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?
@AscilCH on GitHub · 2026-11-25 07:35 UTC · original
AscilCH:fix/loader-crash-unwind-overflow-and-unaligned-read→main· +38 −6 · 1 files · 1 commits · openSummary
Fix stack-unwinder safety and bounds-check issues in
crates/victory-loader/src/crash.rs:unwind_into()rsp + 8 > highinteger overflow:rsp + 8panics in debug builds or wraps pasthighin release builds when a crashing thread has a corruptedRsp > usize::MAX - 8.rsp.checked_add(8).is_none_or(|end| end > high)and stop unwinding if an iteration makes no(Rip, Rsp)progress.Unaligned return-address read UB in
unwind_into():entry.is_null()),(rsp as *const u64).read()is UB (and panics in debug builds) if the crashing thread has a misalignedRsp.(rsp as *const u64).read_unaligned()andwrapping_add(8).Defensive
module_of()checks:NoneifGetModuleFileNameWfails (len == 0) or ifaddress < module as usize.Verification
cargo test -p victory-loader --locked:25 passed; 0 failedunit tests (including newcrash::tests::unwind_into_handles_overflowing_and_unaligned_rsp), plus2 passed(load_probe) and1 passed(title_dlls).cargo clippy -p victory-loader --all-targets --all-features --locked -- -D warnings: 0 warnings.cargo xtask policy:171 files ok.(AI-assisted; synthetic unit tests only, no game data.)
View 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.