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!648
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/648/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?
@LAKSHYA-cmd-tech on GitHub · 2026-11-24 06:09 UTC · original
LAKSHYA-cmd-tech:fix/xuser-get-max-users→main· +33 −2 · 1 files · 1 commits · closed without merging## Summary
Fixes the crash at +0xb5a5f8 (read of uninitialized object at offset x68) right after XUserAddAsync during account init (#348, #622, #630).
Root Cause
During account initialization right after XUserAddAsync, the title's auth subsystem calls slot 0x30 (GetMaxUsers) on the user provider interface (IXUserProvider). Previously, slot 0x30 was mapped to missing::<6>, which returned E_NOTIMPL without writing to the caller's output pointer. The title dereferenced the uninitialized pointer, causing an immediate xc0000005 access violation at +0xb5a5f8.
Fix
Verification
ustfmt --edition 2024 --check crates/victory-hle/src/modules/xuser.rs: clean.
@dpalacios69 on GitHub · 2026-11-24 09:53 UTC · original
Thanks for picking this up! There's an ABI bug in
get_max_usersthat needs to be fixed before merging:1. Extra
Handleparameter shiftsoutfromrdxtor8In the public GDK C API (from the documented signature, not from a disassembly of the title),
XUserGetMaxUserstakes only the output pointer — noXUserHandle:Every other slot in
xuser.rsmirrors the C API 1:1 withThisprepended (none of the non-handle slots likeadd_async,find_by_id,register, etc. take a dummyHandle).With the current signature:
under the Windows x64 ABI, the caller passes
maxUsersinrdx, which is ignored, whileput(out, 1)writes1through whatever stale value happens to be inr8(leaving*maxUsersunwritten, and either returningE_INVALIDARGifr8 == 0, silently corrupting 4 bytes ifr8happens to be writable, or crashing with an access violation). The unit test didn't catch this becauseslot::<GetMaxUsers>transmutes the raw vtable pointer to the same 3-arg signature.It should be:
And
get_max_users_reports_one_usershould be updated to match (type GetMaxUsers = extern "system" fn(This, *mut u32) -> HRESULT;). (If you have a capture/disassembly of the call site in#622showing otherwise, please share!)2. Minor: misplaced
VTABLEcommentInserting
get_max_usersbetween// Unset slots (no title seen calls them): ...andstatic VTABLEdetaches that comment fromVTABLE. Movingget_max_usersabove the// Unset slotscomment (or next tocompare/add_async) keeps the comment attached to the table.Reviewed against the diff and the code on
main; not run on hardware. AI-assisted.@molodayamama on GitHub · 2026-11-24 14:05 UTC · original
Independent Windows check of
241b08f4943973800de7c867d332b32d14436cf5(Windows 10 22H2 19045, Rust 1.98.1, MSVC x64).cargo test -p victory-hle --locked --lib get_max_users_reports_one_user -- --test-threads=1 --nocapture: 1 passed.The offline XUser fixture confirms the max-users slot reports one supported user. The test invokes the shim with synthetic arguments.
Only source-built synthetic fixtures were used. AI-assisted verification.
@Marvisak on GitHub · 2026-11-25 00:26 UTC · original
Automated triage for the maintainers. Closing because another open pull request covers the same change.
See #398. Same slot as #398 with a wrong signature: it adds a handle argument the public call does not have, so a real call would write through whatever is in the third argument register. Its crash explanation (the title calling slot 0x30 at account init) is unsupported.
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