XStore: wire offline *Result slots and fix OOB XStoreShowProductPageUIResult slot #475

Merged
nathanbzrr merged 1 commit from upstream-pr/475 into main 2026-11-25 00:11:10 +00:00
nathanbzrr commented 2026-11-24 03:50:20 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by nathanbzrr on 2026-11-24T03:50:20Z.


Problem

Several offline XStore*Async vtable slots (0x118, 0x188, 0x1a8, 0x258) complete their XAsyncBlock with NETWORK_ERROR, while their paired *Result slots in crates/victory-hle/src/modules/xstore.rs were:

  • Missing past the end of VTABLE (Methods<76>, slots 0..=75): calling XStoreShowProductPageUIResult at slot 76 (0x260) reads past VTABLE.
  • Left as missing::<N> returning E_NOTIMPL instead of NETWORK_ERROR (0x120 XStoreReportConsumableFulfillmentResult, 0x190 XStoreShowPurchaseUIResult, 0x1b0 XStoreShowRedeemTokenUIResult).
  • Using status (2 args) at slot 34 (0x110, XStoreQueryConsumableBalanceRemainingResult) instead of 3-arg count_status taking (This, *mut AsyncBlock, *mut u32).

What changed

  • Extended xstore::VTABLE in crates/victory-hle/src/modules/xstore.rs from Methods<76> to Methods<77>.
  • Wired slot 34 (0x110, XStoreQueryConsumableBalanceRemainingResult) and slot 36 (0x120, XStoreReportConsumableFulfillmentResult) to count_status.
  • Wired slot 50 (0x190, XStoreShowPurchaseUIResult), slot 54 (0x1b0, XStoreShowRedeemTokenUIResult), and slot 76 (0x260, XStoreShowProductPageUIResult) to status.
  • Added synthetic unit test offline_async_calls_report_network_error_from_their_result_slots verifying VTABLE bounds and 0x258/0x260, 0x118/0x120, 0x188/0x190, 0x1a8/0x1b0, and 0x108/0x110.

Tests (isolated branch 2c22e2b)

  • rustfmt --edition 2024 --check crates/victory-hle/src/modules/xstore.rs: passed (exit 0).
  • cargo test -p victory-hle --lib xstore: 2 passed, 0 failed, 85 filtered out (modules::xstore::tests::offline_async_calls_report_network_error_from_their_result_slots, modules::xstore::tests::the_game_is_licensed_and_the_store_is_offline).
  • cargo clippy -p victory-hle --all-targets: passed (exit 0; 0 errors/warnings in crates/victory-hle/src/modules/xstore.rs).
  • cargo xtask policy: asset policy: 151 files ok.

No game files. AI-assisted; reviewed and verified with the tests above.

<!-- greyfinch-sync:Marvisak/VIctory:issue:6574191296 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/475). Originally posted by [nathanbzrr](https://github.com/nathanbzrr) on 2026-11-24T03:50:20Z. --- ## Problem Several offline `XStore*Async` vtable slots (`0x118`, `0x188`, `0x1a8`, `0x258`) complete their `XAsyncBlock` with `NETWORK_ERROR`, while their paired `*Result` slots in `crates/victory-hle/src/modules/xstore.rs` were: - Missing past the end of `VTABLE` (`Methods<76>`, slots `0..=75`): calling `XStoreShowProductPageUIResult` at slot 76 (`0x260`) reads past `VTABLE`. - Left as `missing::<N>` returning `E_NOTIMPL` instead of `NETWORK_ERROR` (`0x120` `XStoreReportConsumableFulfillmentResult`, `0x190` `XStoreShowPurchaseUIResult`, `0x1b0` `XStoreShowRedeemTokenUIResult`). - Using `status` (2 args) at slot 34 (`0x110`, `XStoreQueryConsumableBalanceRemainingResult`) instead of 3-arg `count_status` taking `(This, *mut AsyncBlock, *mut u32)`. ## What changed - Extended `xstore::VTABLE` in `crates/victory-hle/src/modules/xstore.rs` from `Methods<76>` to `Methods<77>`. - Wired slot 34 (`0x110`, `XStoreQueryConsumableBalanceRemainingResult`) and slot 36 (`0x120`, `XStoreReportConsumableFulfillmentResult`) to `count_status`. - Wired slot 50 (`0x190`, `XStoreShowPurchaseUIResult`), slot 54 (`0x1b0`, `XStoreShowRedeemTokenUIResult`), and slot 76 (`0x260`, `XStoreShowProductPageUIResult`) to `status`. - Added synthetic unit test `offline_async_calls_report_network_error_from_their_result_slots` verifying `VTABLE` bounds and `0x258`/`0x260`, `0x118`/`0x120`, `0x188`/`0x190`, `0x1a8`/`0x1b0`, and `0x108`/`0x110`. ## Tests (isolated branch `2c22e2b`) - `rustfmt --edition 2024 --check crates/victory-hle/src/modules/xstore.rs`: passed (exit 0). - `cargo test -p victory-hle --lib xstore`: 2 passed, 0 failed, 85 filtered out (`modules::xstore::tests::offline_async_calls_report_network_error_from_their_result_slots`, `modules::xstore::tests::the_game_is_licensed_and_the_store_is_offline`). - `cargo clippy -p victory-hle --all-targets`: passed (exit 0; 0 errors/warnings in `crates/victory-hle/src/modules/xstore.rs`). - `cargo xtask policy`: `asset policy: 151 files ok`. No game files. AI-assisted; reviewed and verified with the tests above.
mercuryVM commented 2026-11-24 06:53:16 +00:00 (Migrated from github.com)

Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T06:05:58Z.

Review: APPROVED


Tested 2c22e2b on Windows 11, RTX 5070, MSVC: cargo test --workspace --no-fail-fast passes (265 passed, 0 failed).

  • The out-of-bounds read is real. 0x260 / 8 = 76, past Methods<76>. A title calling XStoreShowProductPageUIResult read whatever followed VTABLE. Extending it to 77 fixes that.
  • 0x110 (XStoreQueryConsumableBalanceRemainingResult) and 0x120 (XStoreReportConsumableFulfillmentResult) both take an XStoreConsumableResult*, whose first field is a uint32_t quantity, so count_status fits. The test checks that the out-value is left alone on NETWORK_ERROR.
  • Swapping missing::<N> for status on the three UI result slots matches what their async halves already report.

No issues found.

AI-assisted (Claude Code).

<!-- greyfinch-sync:Marvisak/VIctory:review:6034471835 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/pull/475#pullrequestreview-6034471835). Originally posted by [mercuryVM](https://github.com/mercuryVM) on 2026-11-24T06:05:58Z. **Review:** APPROVED --- Tested 2c22e2b on Windows 11, RTX 5070, MSVC: `cargo test --workspace --no-fail-fast` passes (265 passed, 0 failed). - The out-of-bounds read is real. `0x260 / 8 = 76`, past `Methods<76>`. A title calling `XStoreShowProductPageUIResult` read whatever followed `VTABLE`. Extending it to 77 fixes that. - `0x110` (`XStoreQueryConsumableBalanceRemainingResult`) and `0x120` (`XStoreReportConsumableFulfillmentResult`) both take an `XStoreConsumableResult*`, whose first field is a `uint32_t` quantity, so `count_status` fits. The test checks that the out-value is left alone on `NETWORK_ERROR`. - Swapping `missing::<N>` for `status` on the three UI result slots matches what their async halves already report. No issues found. AI-assisted (Claude Code).
upstream-sync closed this pull request 2026-11-25 01:03:54 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Marvisak/VIctory!475
No description provided.