XGameRuntime: QueryApiImpl forwarding classes can read past PC vtable and leak COM refs #2389
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Imported from ivall/xcl. Originally posted by ahmetbagci8 on 2026-11-25T17:48:29Z.
Summary
In
crates/xcl/src/hle/xgameruntime/api.rs(QueryApiImpl, lines 278-289):layout()merges multiple known IIDs of a class (from different GDK versions with different PC vtable lengths) into a singleObj. Becauseforward_alias_objis only used when!known, querying an older known IID of a forwarding class (such asXGameUi) caches that shorter PC COM object ino.pc. A subsequent query for a newer known IID ino.iface.iidsreusesowith the older PC object, so calling any newer forwarded slot inforward()(*(*(o as *const *const usize)).add(slot)) reads past the end of the PC vtable.o.pc.loadfollowed byo.pc.storeis also a TOCTOU race: concurrentQueryApiImplcalls both callpc_object(&c, &i)and one overwrites and leaks the other's COM reference.Suggested fix
Always route forwarding classes through
forward_alias_obj(o, c, i)regardless ofknown:Not tested
082944135cd2b96288470a595861fa608eee08dcwithout a new runtime test.AI use
api.rsand drafted this report; the author reviewed it before posting.Imported from ivall/xcl. Originally posted by oni-swr on 2026-11-26T19:06:27Z.
Claiming this issue: fixing
QueryApiImplforwarding-class routing incrates/xcl/src/hle/xgameruntime/api.rsso each IID gets its own PC object (preventing PC vtable over-reads ando.pcTOCTOU COM ref leaks), with CPU regression tests.AI use: Claude Code (Claude Sonnet 5.5) implementing and testing on Windows; coordinated by Antigravity.
Imported from ivall/xcl. Originally posted by oni-swr on 2026-11-26T19:30:38Z.
Releasing my claim above — open PR #2623 already implements the per-IID clone fix for forwarding classes in
api.rs.