HLE/net: a blocked name lookup clears the caller's result slot #1448
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1448"
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 fxceless/victory-fork. Originally posted by CwWwWwW on 2026-11-27T09:07:18Z.
Problem
This layer answers forward name lookups offline: a name that is not
localhostor an IP literal fails withWSAHOST_NOT_FOUNDwithout asking the host. The four wrappers that carry a result-list out-parameter did that with a barereturn WSAHOST_NOT_FOUND;before writing the caller's slot:getaddrinfo(net.rs:540)GetAddrInfoW(net.rs:554)GetAddrInfoExA(net.rs:568)GetAddrInfoExW(net.rs:588)Windows' own failed lookup does set the slot to null - verified offline with a standalone probe (no game): with the slot poisoned to
0x1234,getaddrinforeturning 11001 (WSAHOST_NOT_FOUND) and returning 10044 (bad hints) both leave*result == NULL. So a title that treats the slot as "free or reuse it on the error path" (e.g.freeaddrinfo()in a cleanup label, or reusing the variable for the next lookup) finds a wild pointer - an access violation that kills the emulator - or a stale list pointer, a double free. It also diverges from the host/console behaviour on a path every title hits on its first attempt to reach a server.Fix
A small helper clears the slot when non-null and returns
WSAHOST_NOT_FOUND; the four blocked returns use it.getnameinfo/GetNameInfoWhave no list out-parameter and are unchanged, as isgethostbyname, which returns its pointer directly. One file changed (crates/victory-hle/src/modules/net.rs, +83/-4 including the test).Regression test
net::tests::blocked_lookups_clear_the_result_slotpoisons the slot with a sentinel and calls all four wrappers with a blocked name: on the old code it fails at the first assertion (getaddrinfo left the caller's slot); with the change all four null it, and a null slot is tolerated.Verification
cargo test -p victory-hle --lib --locked: 104 passed, 0 failedcargo clippy -p victory-hle --all-targets --locked -- -D warnings: cleancargo clippy -p victory-hle --all-targets --all-features --locked -- -D warnings: cleangit diff --check: clean; one file changedFound by this mission's read-only audit of the net module (its other categories - threads, socket/handle lifetime, buffer ownership, locks - came out clean); independently implemented for this tree, no external code used.
The PR's Clippy check fails on main already: at
9a9091dcargo clippy --workspace --all-targetsfails invictory-shader(wave64_after_loop.rs precedence; valu_tests.rs simplifiable/negated partial-ord comparisons), which open PR #1440 fixes; this diff touches onlyvictory-hle/src/modules/net.rs, whose clippy is clean here (default and --all-features).Imported from fxceless/victory-fork. Originally posted by CwWwWwW on 2026-11-27T16:21:37Z.
Superseded on the VIctory-NVIDIA tree that replaced main: crates/victory-hle/src/modules/net.rs already has blocked_lookup() clearing the caller's result slot in all four wrappers, with its test. Closing.
Pull request closed