HLE: UuidFromString reads only what rpcrt4 reads #5037
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/5037"
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?
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by breachato on 2026-12-01T17:57:55Z.
What it changes
UuidFromStringA/W(modules/rpcrt4.rs) took more than the host's rpcrt4 does:{...}with braces, balanced or not, 32 digits with no dashes, and dashes anywhere. And a null string gaveRPC_S_INVALID_STRING_UUID, where rpcrt4 writes the nil UUID and returnsRPC_S_OK.parsenow takes exactlyxxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx(hex in either case, dashes at 8, 13, 18 and 23), and a null string gives the nil UUID. A title that checks a string withUuidFromStringbefore using it now gets what it would get on Windows. Nothing else in the crate callsparse.How it was tested
No GPU or game needed.
Host behaviour measured on Windows 11 26200, calling
rpcrt4!UuidFromStringAthrough P/Invoke:main1234abcd-00ef-4a5b-8012-3456789abcde{1234abcd-00ef-4a5b-8012-3456789abcde}{...or...}(one brace only)1234abcd00ef4a5b80123456789abcde12-34abcd-00ef-...""New test
uuid_from_string_reads_only_what_the_runtime_readschecks each row above through both the A and W calls. It fails onmain(the braces case is accepted there).cargo test -p victory-hle --lib --locked modules::rpcrt4: 6 passed.cargo clippy -p victory-hle --no-deps --all-targets: nothing inrpcrt4.rs.cargo testpassed for the crates it touches: yesHow to try it
cargo test -p victory-hle --lib --locked uuid_from_string_reads_only.Checked for overlap
rpcrt4.rs(it changes the allocator inallocate/free), with no overlap with this change.Assisted by Claude.
Imported from trustno1-coder/VIctory-NVIDIA. Originally posted by cloph-dsp on 2026-12-01T18:32:49Z.
Verification (independent, AI-assisted: Hy4 flash). Windows, Rust 1.100.0 (Scoop rust-msvc), MSVC, commit-scoped shallow worktree.
Base
5fabb46eaf6ed8771321787f8871051abde69b9b, head3ca06d919e3d6d208a56173bca74e33f412676ca.git diff --numstat→ crates/victory-hle/src/modules/rpcrt4.rs 72/15.The test is new on the base:
→ no match, exit 1.
git diff --check "5fabb46e..3ca06d91"→ no output, exit 0.Result:
running 1 test,test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 482 filtered out.What it pins, through both
UuidFromStringAand the wideUuidFromStringW: the plain 36-character form in either case parses; a leading or trailing brace, braces dropped, dashes removed, a dash moved out of position, one digit missing and the empty string all giveINVALID_STRING_UUID; a null string pointer givesOKwith the nil GUID, and the wide path is asserted to answer exactly as the narrow one for every case.Two things worth naming, both about semantics rather than the test:
n == 0 && c == b'{', plus a closing brace after the last digit) and are refused now. The test pins the new reading, so it cannot also demonstrate the old one was wrong — that rests on the measurement the code comment cites (Windows 11 26200).UuidFromStringA(null, ptr)now writesNIL. Nothing else in the tree passes a null text pointer, so that arm has no caller coverage beyond this case.No title data, no device; GPU/driver N/A. No game data.
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.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.