Files: CreateFileW and CreateFile2 no longer crash on a null path #2654
No reviewers
Labels
No labels
AMD
audio
bug
confirmed
crash
cutscene
dlss
documentation
duplicate
enhancement
fixed-on-main
frame-generation
good first issue
help wanted
input
INTEL
invalid
lighting
linux-proton
memory
needs-info
needs-logs
needs-rebase
NVIDIA
performance
pr-diagnostics
pr-docs
pr-feature
pr-fix
pr-performance
pr-refactor
pr-tests
question
RAYTRACING
rendering
report
series-s
shaders
spam
startup
upstream
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/trustno1-coder--VIctory-NVIDIA!2654
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2654"
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?
@iBooM72 on GitHub · 2026-11-29 15:36 UTC · original
iBooM72:fix/create-file-null-path→main· +48 −14 · 1 files · 1 commits · merged 2026-11-30 14:12 UTCWhat it changes
CreateFileW(NULL, ...)crashes instead of returning an error. Sincedef7cda6, the code that logs an open's flags reads the path without checking for null.CreateFile2does the same when its parameter block is 12 to 32 bytes.CreateFileAalready checks.On Windows 11, calling the real functions with a null path returns
INVALID_HANDLE_VALUEand error 3 (ERROR_PATH_NOT_FOUND).Both functions had a copy of the same code. One helper,
Wide::shown(), now replaces both and gives an empty string for a null path. The host is still called and returns its own error. Other paths work as before.Found by reading the code. I have no evidence that the game passes a null path, and this isn't linked to any reported crash.
How it was tested
null pointer dereference occurred, atfiles.rs:429(CreateFileW) and:517(CreateFile2).CreateFile2is tested with no block and with a 32-byte block.cargo testpassed for the crates it touches: no.cargo test -p victory-hle --locked --no-fail-fast: 427 passed, 1 failed, in each of 3 runs.a_read_by_range_waits_only_for_a_remapping_that_meets_it(listed in #2420) also fails on unmodified829188e9.cargo test --workspace --locked --no-fail-fast: the same 5 tests fail here and on829188e9. The only difference is the 2 new tests, which pass.829188e9, with no new errors, but stop beforevictory-hle.cargo clippy -p victory-hle --all-targets --locked(without-D warnings) reports nothing infiles.rs. With all features,victory-gpudoesn't compile, so clippy couldn't checkvictory-hle.cargo xtask policy --stagedpassed.Checked for overlap
files.rs, but not this code. #831 and #1577 have an older copy of the file, without the code that crashes.🤖 Generated with Claude Code