DirectStorage: clear out pointers on failure #84

Open
github-bot wants to merge 1 commit from github-bot/gh-84 into main AGit
Owner

@⁠davutsimsekk on GitHub · 2026-11-24 21:22 UTC · original
davutsimsekk:fix/dstorage-factory-null-out → main · +62 −0 · 1 files · 1 commits · open

DirectStorage's _COM_Outptr_ methods left *ppv untouched on failure:

  • DStorageGetFactory for an unknown IID or a null IID
  • OpenFile for a null path or a path that cannot be opened
  • CreateQueue for a null description or when the scheduler cannot be created
  • CreateStatusArray did not validate the out pointer before allocating

A title that inspects *ppv after a failed call sees a stale pointer; the file and queue paths could also leak the object they created when put rejected a null out pointer.

This validates and clears *ppv before any work, and leaves the success paths unchanged.

Test

a_refused_factory_interface_clears_the_out_pointer and a_failed_file_or_queue_creation_clears_the_out_pointer use a stale 0x1234 pointer and assert it is null after each failure; the second checks a null path and a null queue description. On main both remain stale.

  • cargo test -p victory-hle --lib: 98 passed, 0 failed
  • cargo clippy -p victory-hle --all-targets --locked -- -D warnings: clean
  • The changed hunks are rustfmt-clean; the file has unrelated pre-existing formatting.
  • No game data or GPU was used.
**@⁠davutsimsekk** on GitHub · 2026-11-24 21:22 UTC · [original](https://github.com/fxceless/victory-fork/pull/84) `davutsimsekk:fix/dstorage-factory-null-out` → `main` · +62 −0 · 1 files · 1 commits · open `DirectStorage`'s `_COM_Outptr_` methods left `*ppv` untouched on failure: - `DStorageGetFactory` for an unknown IID or a null IID - `OpenFile` for a null path or a path that cannot be opened - `CreateQueue` for a null description or when the scheduler cannot be created - `CreateStatusArray` did not validate the out pointer before allocating A title that inspects `*ppv` after a failed call sees a stale pointer; the file and queue paths could also leak the object they created when `put` rejected a null out pointer. This validates and clears `*ppv` before any work, and leaves the success paths unchanged. ## Test `a_refused_factory_interface_clears_the_out_pointer` and `a_failed_file_or_queue_creation_clears_the_out_pointer` use a stale `0x1234` pointer and assert it is null after each failure; the second checks a null path and a null queue description. On `main` both remain stale. - `cargo test -p victory-hle --lib`: 98 passed, 0 failed - `cargo clippy -p victory-hle --all-targets --locked -- -D warnings`: clean - The changed hunks are rustfmt-clean; the file has unrelated pre-existing formatting. - No game data or GPU was used.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 03:35:54 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/84/head:github-bot/gh-84'
git switch 'github-bot/gh-84'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-84'
git switch 'github-bot/gh-84'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-84'
git switch 'github-bot/gh-84'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-84'
git switch 'main'
git merge --squash 'github-bot/gh-84'
git switch 'main'
git merge --ff-only 'github-bot/gh-84'
git switch 'main'
git merge 'github-bot/gh-84'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.