HLE: guard against null GWLP_USERDATA in XGameUi dialog WM_COMMAND handler #1373
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!1373
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/1373/head"
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?
@mgunes1311-lab on GitHub · 2026-11-24 17:39 UTC · original
mgunes1311-lab:hle-xgameui-null-userdata→main· +54 −11 · 1 files · 1 commits · closed without mergingIn
crates/victory-hle/src/modules/xgameui.rs,dialog::procedurepreviously formed&mut *(wm::GetWindowLongPtrW(dialog, wm::GWLP_USERDATA) as *mut Entry)unconditionally in theWM_COMMANDhandler. IfWM_COMMANDarrives beforeWM_INITDIALOGinitializesGWLP_USERDATA, forming&mut Entryfrom null is immediate UB and crashes onIDOK.Changes
(wm::GetWindowLongPtrW(dialog, wm::GWLP_USERDATA) as *mut Entry).as_mut()indialog::procedureand return0when user data is null.dialog::procedurepub(super)for direct unit testing and addeddialog_wm_command_ignores_missing_user_data.Verification
cargo test -p victory-hle --target x86_64-pc-windows-msvc --locked xgameui::(2 passed; 0 failed)cargo clippy --workspace --all-targets --target x86_64-pc-windows-msvc --locked -- -D warningsRUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --target x86_64-pc-windows-msvc --lockedcargo run -p xtask --target x86_64-pc-windows-msvc --locked -- policy --staged(asset policy: 1 files ok)@acetonahard-code on GitHub · 2026-11-24 21:03 UTC · original
Tested on Windows 11 with the repo toolchain, merged into current
main(ffe310e):cargo test -p victory-hlemainmain+ this PRcargo clippy --all-targets -- -D warnings, with and without--all-features: clean.I didn't test with game data.
Tested locally with an AI-assisted script (Claude Code); I checked the results before posting.
@Marvisak on GitHub · 2026-11-25 00:38 UTC · original
Automated triage for the maintainers. Closing because another open pull request covers the same change.
See #1515. Same null user-data guard as #1515, wrapped in reformatting of unrelated lines and a visibility change.
If this is mistaken, reply here with what was missed (or push a change and say so) and it will be looked at again. Thank you for the contribution.
Pull request closed