Input: DualSense device paths end in a NUL #40
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!40
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-40"
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?
@WHOISJARDAS on GitHub · 2026-11-25 12:34 UTC · original
WHOISJARDAS:input/dualsense-path-nul→main· +16 −2 · 1 files · 1 commits · opendevice_pathscopies each HID interface path without its terminating NUL (from_raw_parts(path, len).to_vec()), andopen_padpasses the copy toCreateFileW, which reads a path up to its NUL, so it read past the end of the copy. With no DualSense connected the scan runs every 2 s for the whole run, and once a copy happened to end a heap page, the read went into an unmapped page and the run ended.Seen here on this fork's
4cbe9d7(+ the low 4 GiB guards, so that it starts on this machine): RX 9070 XT, no DualSense connected, 231 s into the run:(names from Microsoft's public symbols for this machine's ntdll/KernelBase and the diag build's PDB)
Each path now keeps its NUL (
path.push(0)). New testdevice_paths_end_in_a_nulchecks every path the scan returns: on this machine 18 HID interfaces; it fails without the change and passes with it. The ignoredlists_and_opens_hid_devicesprints the paths without the NUL.The same code is in Marvisak/VIctory#150, where this module comes from; I'll leave a note there.
Tested
cargo test -p victory-hle --lib dualsense: 7 passed, 1 ignored (the new test fails without the change)cargo clippy -p victory-hle --all-targets: no new findings (the ones it reports are invictory-shader, the same on4cbe9d7)AI use: Claude Code (Claude Opus 5.5) found it from the crash stack and wrote the change and the test; the run and the hardware are mine.
🤖 Generated with Claude Code
@RodrigoTorreao on GitHub · 2026-11-25 17:58 UTC · original
Seen on a second machine, before this PR: RX 6750 XT, i5-14600KF, 16 GB RAM, Windows 11 26200, no DualSense connected, diag build of
01aadd1(plus a local change invictory-gpuunrelated to input). The run ended 697 s in, while the world was being drawn:The same
reader+0x3fdas in your trace, and a read address at the start of a page. I named frame #4 from the diag build's PDB with dbghelp; I did not look up the ntdll/KernelBase names. It happened again onmaina59f3e5(same local change), 20 s into the run, at the samentdll.dll+0x12d844, read0x2449395e000: 2 of the 9 runs I made today without this PR.With this PR's commit (
9501e2a) cherry-picked, 3 runs (129 to 399 s) had no such crash. Since the crash depends on where a heap page ends, that shows little on its own; the change reads right to me:CreateFileWgets a NUL-terminated path now.AI-assisted (Claude Code): the runs, the symbol lookup and this text. No game data.
@Ekabusto on GitHub · 2026-11-25 13:39 UTC · original · reviewed
Tested here: RX 9070 XT (Adrenalin 26.11.2, driver 32.0.32029.2010), Ryzen 9 5900X, 32 GB, Windows 11 build 26300, no DualSense connected.
Without the fix (
mainat71652a2): the run crashed 11 min 22 s in with the same signature as in the description:(victory.exe frame resolved against the release build's PDB.)
With the fix: the change applied cleanly on top of
mainat71652a2. I tested that, not the PR branch, which is 9 commits behind.cargo test -p victory-hle --lib dualsense: 7 passed, 1 ignored, includingdevice_paths_end_in_a_nul.Not tested: a connected DualSense.
The change looks right to me:
CreateFileWneeds a NUL-terminated path, and the new test covers it.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.