HLE media: block UNC share bypasses for localhost and \??\ file URLs #3121
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!3121
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-3121"
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?
@Arkenoz on GitHub · 2026-11-26 08:58 UTC · original
Arkenoz:fix/media-local-unc-bypasses→main· +76 −4 · 1 files · 1 commits · openSummary
Closes two remaining UNC share bypasses in
media::local(crates/victory-hle/src/modules/media.rs) following up on #207:file://localhost/...with extra leading separators:this_machine == truepreviously skippedshare(&whole)completely. Becauseshlwapi.dll!PathCreateFromUrlWconsumes only a single leading separator afterlocalhost, URLs such asfile://localhost///server/share/a.mp4,file://localhost/\\server/share/a.mp4, andfile://localhost/%5C%5Cserver/share/a.mp4resolve to remote UNC paths (\\server\share\a.mp4/\\\server\share\a.mp4) and were allowed through.media::localnow strips one leading separator whenthis_machineis set and still runsshare(...)on the remainder, keepingfile://localhost//server/share/a.mp4(\server\share\a.mp4) local.\??\object-manager prefixes infile:URLs: URLs likefile:///%3F%3F/UNC/server/share/a.mp4decode to\??\UNC\server\share\a.mp4inPathCreateFromUrlWwithout starting with two separators.media::localnow rejects decoded\??\paths unless followed by a drive letter, strippingUNC\case-insensitively when extracting the host.Testing
localhost_and_object_prefix_file_urls_are_refused(verified failing before the fix and passing after) and Windows oracle testthe_host_reads_localhost_and_object_prefix_share_urls_as_sharesagainstshlwapi.dll!PathCreateFromUrlW.rustfmt --edition 2024 --check crates/victory-hle/src/modules/media.rs— passedcargo clippy --workspace --all-targets -- -D warnings— passedcargo check --workspace --all-targets— passedcargo xtask policy— passed (asset policy: 191 files ok)cargo test -p victory-hle --locked— passed (154lib +fidelityfx+no_dll_planting)Coordination & AI disclosure
@Dukestar69 on GitHub · 2026-11-26 09:09 UTC · original · approved these changes
Verified against
origin/main(63bcca4):cargo test -p victory-hle --lib modules::media:: -- --test-threads=1: 7/7 passed (includinglocalhost_and_object_prefix_file_urls_are_refusedandthe_host_reads_localhost_and_object_prefix_share_urls_as_shares).cargo clippy -p victory-hle --all-targets -- -D warnings: clean.cargo xtask policy: 191 files ok.Cleanly closes the
localhostand\??\UNC share bypasses inmedia.rs.Synthetic tests only (no game files used). AI-assisted (Gemini 4 Neon).
@Marvisak on GitHub · 2026-11-26 09:17 UTC · original
Automated triage for the maintainers.
Merge candidate. This makes the URL rule in
media::local(crates/victory-hle/src/modules/media.rs) stricter and loosens nothing. Onmain,!this_machine && share(&whole)skipped the share check for everyfile://localhost/...URL. Now the check runs on every non-drivefile:path, and forlocalhostit runs after removing one leading separator. That refuses everythingmainrefused and alsofile://localhost///server/...,file://localhost/\\server/...and the percent-encoded spelling. The new\??\check on the decoded path refusesfile:///%3F%3F/UNC/server/.... I found no local path that is now wrongly refused, and the controls (localhost//,\??\C:) still pass. The Windows test readsPathCreateFromUrlW's own output, so it backs the claim about host behaviour. Nit: itslocalhost//assertion repeats one inthe_host_reads_those_spellings_as_shares.CI:
checkpassing.Generated by Claude Code
@fuzeofficlal on GitHub · 2026-11-26 09:33 UTC · original · requested changes
Verified
afd63d5elocally on Windows 11 x64:cargo clippy --all-targets --locked -- -D warnings: clean (3.14s).cargo test -p xtask --locked policy::tests::repository_passes_policy: 1 passed, 0 failed (0.34s).cargo test -p victory-hle --locked: 156 passed, 0 failed (154lib including all 7modules::media::tests+1fidelityfx +1no_dll_planting,5.00s).rustfmt --edition 2024 --check crates/victory-hle/src/modules/media.rs: clean.The added
effectiveand\??\checks close the submittedfile://localhost///...,file://localhost/\\...,file://localhost/%5C%5C..., andfile:///%3F%3F/UNC/...cases. However, for non-drivefile:URLs (media.rs:92-116),local()validates decoded Rust views (whole/path) and then returnsOk(with_nul(url)), handing the original raw UTF-16 URL to Media Foundation to re-parse (for example with mixed encoded separators or namespace combinations). Please validate the host-converted path (or hand Media Foundation the exact normalized local path that passed the check) consistently across both resolver entry points, and expand the Windows conversion coverage for mixed separators and percent-encoded slashes.@Arkenoz on GitHub · 2026-11-26 10:33 UTC · original
Thanks for the thorough review and local verification! That's a good point about validating/passing the host-normalized path rather than the raw UTF-16 URL. Since this PR is intentionally kept minimal and already marked as a merge candidate, I'd prefer to keep it focused on closing the
localhostand\??\bypasses and leave normalizing the return path across both resolver entry points for a separate follow-up PR.@futurepro62 on GitHub · 2026-11-26 20:20 UTC · original
NVIDIA full-suite run, to go with the reports above by Dukestar69, fuzeofficlal, since none of them names a GPU run. Tested exact head
afd63d5(on its base63bcca4).Tested
dxil.dllfrom Windows SDK 10.0.26100 (the loader's default), debug.cargo build --workspace --locked, thencargo test --workspace --locked --no-fail-fast -- --test-threads=4 --skip emit::memory_tests::heap_direct_texture_reads_mark_their_heap_index --skip descriptor::host::tests::dynamic_slots_are_held_until_released --skip memory::tests::lists_share_a_table_and_copies_keep_their_views --skip emit::stride_tests::a_heap_buffer_read_by_element_takes_the_views_stride --skip emit::stride_tests::a_heap_buffer_read_where_no_buffer_view_is_reads_zeros --skip emit::synthetic_tests::gathers_at_a_level_match_the_hardware: 868 passed, 0 failed, 10 ignored.localhost_and_object_prefix_file_urls_are_refused,the_host_reads_localhost_and_object_prefix_share_urls_as_shares.--skipleaves out tests that fail on main63bcca4on this card too, not because of this PR:heap_direct_texture_reads_mark_their_heap_indexends thevictory-shadertest process with0xc0000005(#2571), so without the skip the rest of that crate never reports;dynamic_slots_are_held_until_released,lists_share_a_table_and_copies_keep_their_viewsand the twostride_testshit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317);gathers_at_a_level_match_the_hardwarefails on lane 0 (#1744).Not tested
AI use
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.