xbtp: honor the session QueryInterface output contract #311

Closed
github-bot wants to merge 1 commit from gh-pr/311/head into gh-pr/311/base
Owner

@⁠BaggyALPHA on GitHub · 2026-11-23 17:33 UTC · original
BaggyALPHA:fix/xbtp-session-queryinterface → main · +53 −0 · 1 files · 1 commits · closed without merging

The XBTP client session's QueryInterface dereferences a null output address for a supported IID, and leaves the caller's previous output pointer intact when returning E_NOINTERFACE for an unsupported IID.

Validate the output address first, returning E_POINTER when it is null, and clear the result before checking the IID. Successful queries retain the existing COM identity and add exactly one reference.

Library / area: xbtp, SessionImpl::QueryInterface and vtable regression tests.

Exports changed (exports.txt rows): None.

Source of the behaviour: Microsoft's IUnknown::QueryInterface contract. The existing DispatcherCom implementation in this repository already follows these output rules.

Validation:

  • Three tests exercise the actual COM vtable: unsupported IID clears a pre-populated result without AddRef; null output addresses return E_POINTER without AddRef; all supported IIDs preserve identity and balance AddRef/Release.

  • The stale-output test fails before the fix and passes afterward. No pre-fix null-pointer crash was executed.

  • cargo test --locked -p xbtp --lib --test dispatch_link --test link_dev -- --test-threads=1: 120 unit tests and five integration tests passed.

  • cargo check --locked -p xbtp --all-targets: passed.

  • Contribution gate, whitespace check, and patch application check: passed.

  • Full default suite attempted: cargo test --locked -p xbtp --no-fail-fast -- --test-threads=1. All 120 unit tests plus dispatch_link (1) and link_dev (4) passed outside the Codex sandbox. The full command exits unsuccessfully because all three console_fixed tests require unavailable console DLL fixtures (two require at least four images). The eight verify_oracle tests report success after returning early without a console DLL; they are not console validation.

  • No game or console files and no binaries included.

  • No fake success; no export status changes.

Related to #1. This fixes one documented COM error-handling contract; it does not claim to complete that issue or establish console/title compatibility. No console oracle was used, and existing tests that return early without reference fixtures are not evidence of console equivalence.

CI status: GitHub currently reports action_required for this PR’s workflow runs, with zero Rust jobs started. Maintainer action is still needed before upstream CI results are available. Local validation is not a substitute for successful required CI.

**@⁠BaggyALPHA** on GitHub · 2026-11-23 17:33 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/311) `BaggyALPHA:fix/xbtp-session-queryinterface` → `main` · +53 −0 · 1 files · 1 commits · closed without merging The XBTP client session's `QueryInterface` dereferences a null output address for a supported IID, and leaves the caller's previous output pointer intact when returning `E_NOINTERFACE` for an unsupported IID. Validate the output address first, returning `E_POINTER` when it is null, and clear the result before checking the IID. Successful queries retain the existing COM identity and add exactly one reference. **Library / area:** `xbtp`, `SessionImpl::QueryInterface` and vtable regression tests. **Exports changed (exports.txt rows):** None. **Source of the behaviour:** [Microsoft's IUnknown::QueryInterface contract](https://learn.microsoft.com/en-us/windows/win32/api/unknwn/nf-unknwn-iunknown-queryinterface(refiid_void)). The existing `DispatcherCom` implementation in this repository already follows these output rules. **Validation:** - Three tests exercise the actual COM vtable: unsupported IID clears a pre-populated result without AddRef; null output addresses return `E_POINTER` without AddRef; all supported IIDs preserve identity and balance AddRef/Release. - The stale-output test fails before the fix and passes afterward. No pre-fix null-pointer crash was executed. - `cargo test --locked -p xbtp --lib --test dispatch_link --test link_dev -- --test-threads=1`: 120 unit tests and five integration tests passed. - `cargo check --locked -p xbtp --all-targets`: passed. - Contribution gate, whitespace check, and patch application check: passed. - [x] Full default suite attempted: `cargo test --locked -p xbtp --no-fail-fast -- --test-threads=1`. All 120 unit tests plus `dispatch_link` (1) and `link_dev` (4) passed outside the Codex sandbox. The full command exits unsuccessfully because all three `console_fixed` tests require unavailable console DLL fixtures (two require at least four images). The eight `verify_oracle` tests report success after returning early without a console DLL; they are not console validation. - [x] No game or console files and no binaries included. - [x] No fake success; no export status changes. Related to #1. This fixes one documented COM error-handling contract; it does not claim to complete that issue or establish console/title compatibility. No console oracle was used, and existing tests that return early without reference fixtures are not evidence of console equivalence. **CI status:** GitHub currently reports `action_required` for this PR’s workflow runs, with zero Rust jobs started. Maintainer action is still needed before upstream CI results are available. Local validation is not a substitute for successful required CI.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 06:18:13 +00:00
github-bot closed this pull request 2026-11-26 06:18:13 +00:00
Author
Owner

@⁠omonkeyz on GitHub · 2026-11-25 13:49 UTC · original

Applied on main in 74afeb3 (cherry-picked onto the current history with your authorship kept; comment lines stripped per CONTRIBUTING). Thank you.

**@⁠omonkeyz** on GitHub · 2026-11-25 13:49 UTC · [original](https://github.com/omonkeyz/xbox-emulator/pull/311#issuecomment-7164339611) Applied on main in 74afeb3 (cherry-picked onto the current history with your authorship kept; comment lines stripped per CONTRIBUTING). Thank you.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.