HLE: require two hex digits in percent escapes #480
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/480"
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 Marvisak/VIctory. Originally posted by enzoduarte1 on 2026-11-24T03:53:22Z.
What
media::percent_decodeusedu8::from_str_radix(.., 16)directly on the two bytes after%. That parser accepts a leading+, so afile:URL such asfile:///C:/a%+1.mp4decoded%+1into byte0x01instead of leaving the escape literal.The decoder now requires both characters to be ASCII hex digits before parsing. Real escapes (
%20,%FF) still decode; malformed ones (%+1,%2,%%20) are copied verbatim. Tests cover those cases.Tested
x86_64-pc-windows-gnu(no MSVC linker on this machine).cargo test -p victory-hle --lib media::: 3 passed.cargo test --workspace --exclude victory-loader -- --test-threads=1: all suites passed.cargo clippy -p victory-hle --all-targets -- -A clippy::field_reassign_with_default -D warnings: clean. The allowed lint is the pre-existing warning fixed by PR #355.rustfmt --edition 2024 --check crates/victory-hle/src/modules/media.rsandgit diff --check: clean.cargo xtask policy: 151 files ok. No game files or data taken from them were added.cargo test -p victory-loader --test load_probe. Its fixture passes MSVC's/DELAYLOADflag, which MinGW rejects here; the same failure occurs on unmodifiedmain.Checklist
cargo fmt,cargo clippy --workspace --all-targetsandcargo test --workspacepass — see the toolchain limitations above; the changed crate is clean.cargo xtask policypasses. The change adds no game files or data taken from them (docs/asset-policy.md).Imported from Marvisak/VIctory. Originally posted by mercuryVM on 2026-11-24T05:08:10Z.
Review: APPROVED
Tested
75fe6c0on Windows 11, RTX 5070, MSVC:cargo test --workspace --no-fail-fastpasses (265 passed, 0 failed), includingload_probe.u8::from_str_radixaccepts a leading+, so%+1decoded to 0x01 before this change.is_ascii_hexdigitfilter the laterfrom_utf8can no longer fail, so it is now redundant but harmless.%%20: the first%sees%2, fails the filter and is copied, then%20decodes, giving%as the test expects.No issues found.
AI-assisted (Claude Code).
Imported from Marvisak/VIctory. Originally posted by jeremygold02 on 2026-11-24T17:35:48Z.
Verification at
75fe6c02b278f18eab33ad893bda1dd68d176287:cargo test --locked -p victory-hle --lib percent_decode_requires_two_hex_digits -- --test-threads=1passed (1 passed, 0 failed). The test covers valid%20, signed%+1, incomplete%2, overlapping%%20, and non-hex%2Gescapes; malformed escapes remain literal while later valid escapes still decode.This verification was AI-assisted.