DirectStorage: clear the factory out pointer on failure #1718
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1719"
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 Marvisak/VIctory. Originally posted by davutsimsekk on 2026-11-24T21:15:03Z.
DStorageGetFactoryis declared_COM_Outptr_ void** ppv: on failure*ppvmust be null. When the requested IID was not the factory's (orriidwas null) the HLE returnedE_NOINTERFACEwithout touching*ppv, leaving a stale caller pointer that a title's probe would dereference.This nulls
*ppvbefore matching the IID, returnsE_INVALIDARGfor a null out pointer, and leaves the success path unchanged.Reference: the public
dstorage.hdeclaration ofDStorageGetFactory(REFIID riid, _COM_Outptr_ void** ppv).Test
a_refused_factory_interface_clears_the_out_pointerchecks an unknown IID and a null IID both returnE_NOINTERFACEwith a null out pointer, and a null out pointer returnsE_INVALIDARG.cargo test -p victory-hle --lib: 95 passed, 0 failedcargo clippy -p victory-hle --all-targets --locked -- -D warnings: cleanImported from Marvisak/VIctory. Originally posted by DenRakEiw on 2026-11-24T21:26:27Z.
Review: APPROVED
Verified locally merged onto
origin/main(Windows 11 x64, Rust 1.98.1 MSVC):cargo test -p victory-hle --lib dstorage::— 14 passed, 0 failed (includinga_refused_factory_interface_clears_the_out_pointer)cargo clippy -p victory-hle --all-targets— 0 warningscargo xtask policy— okClean COM out-pointer clearing on
DStorageGetFactoryfailure with unit test coverage. Looks good.AI-assisted (Gemini 4 Neon).
Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T21:56:03Z.
Review: APPROVED
Tested
7714674on Windows 11, RTX 5070, MSVC: builds,cargo test --workspace --no-fail-fast640 passed, 0 failed (on our fork main), clippy-D warningsclean with and without--all-features.a_refused_factory_interface_clears_the_out_pointerpasses._COM_Outptr_requires*ppvto be null on failure, and nulling it before the IID match does that for both the unknown-IID and null-IID paths. The success arm then writes the factory, unchanged.E_INVALIDARGfor a nullppvis what the COM convention expects (some implementations returnE_POINTER, but either is a failure the title checks the same way).Merged into our fork's main.
AI-assisted (Claude Code).
Imported from Marvisak/VIctory. Originally posted by catminou4 on 2026-11-24T22:20:07Z.
Review: COMMENTED
Static review only: victory-hle is Windows-only — nothing compiles or runs on macOS; source review of the diff.
DirectStorage factory out pointer cleared on failure (dstorage.rs, 1.8K) — avoids a dangling pointer on the error path. Small correctness fix.
Imported from Marvisak/VIctory. Originally posted by kais7654 on 2026-11-24T22:38:49Z.
Reviewed and verified: COM_Outptr semantics hold now — the out
pointer is cleared on entry, a null out gets E_INVALIDARG, and the
caller's stale value is gone after E_NOINTERFACE. Test passes on
Windows.
Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T03:35:47Z.
Automated triage for the maintainers.
Merge candidate.
DStorageGetFactoryincrates/victory-hle/src/modules/dstorage.rsnow returnsE_INVALIDARGfor a null out pointer, and sets*outto null before checking the IID, so anE_NOINTERFACEresult no longer leaves the caller's stale pointer. This follows the out-pointer convention, and the success path (throughput) is unchanged. The new test covers an unknown IID, a null IID and a null out pointer. CI has not run.Generated by Claude Code
Imported from Marvisak/VIctory. Originally posted by fuzeofficlal on 2026-11-26T01:01:25Z.
Code review and Windows 11 verification at head
771467458b5dmerged cleanly ontomain(63bcca43c6a0):crates/victory-hle/src/modules/dstorage.rs:52-68):DStorageGetFactorychecksout.is_null()first (E_INVALIDARG), immediately clears*out = null_mut(), and then validatesiid(E_NOINTERFACEfor null/unknown GUIDs with*outguaranteed null,S_OKviaputforFACTORY). New testa_refused_factory_interface_clears_the_out_pointercovers unknown IID, null IID, and nullout.cargo xtask policy:191 files ok;cargo clippy -p victory-hle --all-targets -- -D warnings: 0 warningsvictory-hle --lib -- dstorage:: --test-threads=1: 17/17 passed.LGTM.
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.