HLE: DualSense device paths keep their NUL (CreateFileW read past the copy) #156
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/Belobug--VIctory-Belobug-AMD!156
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-156"
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?
@pjanes22 on GitHub · 2026-11-25 17:48 UTC · original
pjanes22:fix/dualsense-path-nul→main· +5 −1 · 1 files · 1 commits · opendevice_paths()copied each SetupAPI interface path without its terminatingNUL, and
open_pad()passedpath.as_ptr()toCreateFileW, which reads upto a NUL. The reader thread looks for a pad every 2 seconds, so with no
DualSense connected the run stopped at a random moment with an access
violation in ntdll (read past the end of the copy, r11 = STATUS_OBJECT_NAME_NOT_FOUND).
Symbolized stack from a release build: ntdll -> KERNELBASE (CreateFileW) ->
victory_hle::modules::dualsense::open_pad(dualsense.rs:169) ->dualsense::reader.Fix: the owned path gets its NUL pushed.
Tested: Windows 11, RTX 5080, Ryzen 9 7950X3D, no DualSense connected; the
crash no longer occurs in several runs of 5-8 minutes.
AI-assisted: analysis and patch written with Claude, run and tested on my machine.
@KernelSmoker on GitHub · 2026-11-25 18:52 UTC · original
Verified PR head
745bc00(x86_64-pc-windows-gnu, Rust 1.98.1):cargo clippy -p victory-hle --no-deps --all-targets --locked --target x86_64-pc-windows-gnu: no warnings incrates/victory-hle/src/modules/dualsense.rs.modules::dualsense::testsrun under GE-Proton 10-34 / Wine 10.0: 6 passed, 0 failed, plus--ignoredlists_and_opens_hid_devicespassed (enumerated 7 HID interfaces with NUL-terminated paths; no DualSense hardware connected here).open_pad()is the only caller ofdevice_paths()and passespath.as_ptr()directly toCreateFileW, confirming the missing trailing NUL was an out-of-bounds read.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.