DirectStorage: clear out pointers on failure #84

Open
davutsimsekk wants to merge 1 commit from upstream-pr/84 into main
davutsimsekk commented 2026-11-24 21:22:01 +00:00 (Migrated from github.com)

Imported from fxceless/victory-fork. Originally posted by davutsimsekk on 2026-11-24T21:22:01Z.


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.
<!-- greyfinch-sync:fxceless/victory-fork:issue:6591672456 --> Imported from [fxceless/victory-fork](https://github.com/fxceless/victory-fork/pull/84). Originally posted by [davutsimsekk](https://github.com/davutsimsekk) on 2026-11-24T21:22:01Z. --- `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.
upstream-sync changed title from [PR #84] DirectStorage: clear the factory out pointer on failure to [PR #84] DirectStorage: clear out pointers on failure 2026-11-25 04:10:55 +00:00
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/84:upstream-pr/84'
git switch 'upstream-pr/84'

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.

git switch 'main'
git merge --no-ff 'upstream-pr/84'
git switch 'upstream-pr/84'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/84'
git switch 'upstream-pr/84'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/84'
git switch 'main'
git merge --squash 'upstream-pr/84'
git switch 'main'
git merge --ff-only 'upstream-pr/84'
git switch 'main'
git merge 'upstream-pr/84'
git push origin 'main'
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
fxceless/victory-fork!84
No description provided.