Skip to content

Media: a share is refused however it is spelled - #207

Merged
Marvisak merged 1 commit into
Marvisak:mainfrom
Maraco91:media/unc-forms-are-not-local
Nov 25, 2026
Merged

Marvisak merged 1 commit into
Marvisak:mainfrom
Maraco91:media/unc-forms-are-not-local

Conversation

@Maraco91

Copy link
Copy Markdown
Contributor

What

The source-resolver proxy lets a title open local files only (local()), so that Media Foundation cannot fetch over the network past modules::net. It recognises a share as \server\.., //server/.. or file://server/... The host recognises more spellings, and these went through to the host's resolver unchanged:

Title passes local() on main What the host makes of it
/\server\share\a.mp4, \/server/share/a.mp4 "a relative path": passed on \server\share\a.mp4 (GetFullPathNameW)
\??\UNC\server\share\a.mp4 "a relative path": passed on the object manager's spelling of \?\UNC\..; the host's file calls take the prefix as it is
file:////server/share/a.mp4, file://///server/.. "a local file without a drive": passed on \server\share\a.mp4 (PathCreateFromUrlW)
file:\server\share\a.mp4, file:/%5Cserver/share/a.mp4 same \server\share\a.mp4
file:///%5C%5Cserver/share/a.mp4 same \\server\share\a.mp4

Now refused, naming the server, like the spellings already known:

  • a path with two leading separators of either kind;
  • \??\ followed by anything but a drive (the rule \?\ already has);
  • a file: URL that names no host and whose decoded path starts with two separators and is not a drive path.

Unchanged, and checked: \movies\a.mp4 and file:///movies/a.mp4 (one separator), file:////C:/Windows/a.wav (a drive after the slashes: still C:\Windows\a.wav), \??\C:\.., and file://localhost//server/share/a.mp4, which the host reads as the local \server\share\a.mp4.

What I could not check: that Media Foundation's own resolver reads file: URLs the way PathCreateFromUrlW does (it would take a share to test against). I have not seen a title pass such a URL (I have no game files); this closes spellings the rule's own contract says are refused.

Tested

Windows 11 Pro 10.0.26200, rustc 1.98.1 (x86_64-pc-windows-msvc), no game data, no GPU, no network involved (all checks are on strings).

Two new unit tests over one list of spellings:

  • the_host_reads_those_spellings_as_shares (Windows only) pins down the right-hand column above on the host: std::path::absolute for the two path forms, PathCreateFromUrlW for the five URLs, that a \??\ path opens (\??\%SystemRoot%), and the local reading of the three URL controls. It passes on main and with the fix: it is the reference, not the fix's test.
  • shares_are_refused_however_they_are_spelled checks local() refuses all eight, with the scheme and server it reports, and that the five local look-alikes pass as before.

Results:

  • main (d2a4bae) + the tests only: cargo test -p victory-hle --lib media::: shares_are_refused_however_they_are_spelled fails (/\server\share\a.mp4: left: Ok("/\server\share\a.mp4"), right: Err(("unc", "server"))); the host reference passes.
  • with the fix: 4 passed, 0 failed (the 2 existing media tests and the 2 new ones).
  • cargo clippy -p victory-hle --tests: nothing in media.rs. rustfmt --check media.rs: clean.
  • cargo xtask policy --staged: ok.

Not tested: a title run; a real share.

#31 touches the COM release counts in this file, not local().

AI-assisted (Claude Code); the tests above were run on the machine described.

🤖 Generated with Claude Code

The source resolver's rule (local files only) knew a share as `\..`,
`//..` or `file://server/..`. The host knows more spellings: any two
leading separators (`/\server\share`), the object manager's prefix
(`\??\UNC\server\share`), and a `file:` URL with no host whose path
starts with two separators (`file:////server/share`,
`file:\server\share`, also percent-encoded). Those fell through as
relative paths or drive-less local files and went to the host's
resolver unchanged.

They are refused now, naming the server. Paths with one leading
separator, a drive after the slashes or the prefix, and the path of a
URL that names this machine pass as before.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
muhammed-aksoy pushed a commit to muhammed-aksoy/VIctory that referenced this pull request Nov 24, 2026
edsuuu referenced this pull request in edsuuu/VI-BR-PORT Nov 24, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jeremygold02

Copy link
Copy Markdown
Contributor

Thanks @Maraco91 for adding coverage around share paths that can be disguised by their spelling.

I tested commit 11ca3ce4928cf9ac2f77fcdc1c095d41c62fcbce with:

cargo test --locked -p victory-hle --lib shares -- --test-threads=1

Both targeted tests passed (2 passed, 0 failed; 86 filtered):

This verifies the tested path classification and host URL conversion cases. It does not open a real remote share or exercise media playback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants