HLE/dstorage: retain IDStorageFile ref and own Request.name on enqueued reads #403
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/fxceless--victory-fork!403
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-403"
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?
@AscilCH on GitHub · 2026-11-25 00:25 UTC · original
AscilCH:fix/dstorage-retain-file-and-name→main· +116 −18 · 1 files · 1 commits · openProblem
In
crates/victory-hle/src/modules/dstorage.rs,enqueue_requestcopied the caller'sRequestby value without retaining a COM reference onrequest.source(Instance<File>) or copyingrequest.name:IDStorageFileUAF: Unlikeenqueue_status(which callsadd_ref_instanceon the status array and releases it inStatus::drop),enqueue_requestdid not retainrequest.sourcefor file-backed reads (options & MEMORY_SOURCE == 0). If the title calledIDStorageFile::Release()afterEnqueueRequest,Instance<File>and its OSFilehandle were freed immediately before the worker thread ranread_into.Request::nameUAF:request.name(*const c_char) was copied as a raw pointer and dereferenced asynchronously on the worker thread inexecute'sfailclosure, even thoughDSTORAGE_REQUEST::Nameonly needs to outliveEnqueueRequest.Fix
Command::Read(Request),Lane::readsentries, andJob::requestwith an ownedQueuedReadthat:request.nameeagerly viatext(request.name)and nullsrequest.name.add_ref_instanceonrequest.sourcewhenoptions & MEMORY_SOURCE == 0 && !source.is_null().execute(before acquiringscheduler.lock()and signaling status completion) and inDrop(covering unstarted reads discarded byCloseor a closed queue).dstorage::tests::enqueued_request_retains_file_and_copies_name_until_completion.Verification
cargo test -p victory-hle --locked dstorage -- --test-threads=1: 14 passed, 0 failedcargo xtask policy: 169 files okcargo clippy -p victory-hle --all-targets --locked -- -D warnings: cleancargo clippy -p victory-hle --all-targets --all-features --locked -- -D warnings: clean(AI-assisted; synthetic unit tests only, no game data.)
View command line instructions
Manual merge helper
Use this merge commit message when completing the merge manually.
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.