HLE: a '>' in a quoted manifest attribute does not end its tag #359

Manually merged
github merged 1 commit from gh-pr/359/head into gh-pr/359/base 2026-11-26 04:00:45 +00:00
Owner

@⁠Dufftwt on GitHub · 2026-11-24 02:34 UTC · original
Dufftwt:fix/manifest-quoted-angle-bracket → main · +25 −1 · 1 files · 1 commits · merged 2026-11-25 00:10 UTC

What's wrong

runtime::elements reads MicrosoftGame.config to get the title id (Game/TitleId) and the storage quota (Game/PersistentLocalStorage/SizeMB). It ends every tag at the tag's first >.

XML allows > unescaped inside an attribute value (XML 1.0 §3.1: AttValue ::= '"' ([^<&"] | Reference)* '"'). So a manifest with, say:

<ShellVisuals DefaultDisplayName="A > B" … />
<TitleId>639AA8DD</TitleId>

has its ShellVisuals tag cut short at A . The /> that closes the element is never seen, the element stays open, and every element after it is read as its child (Game/ShellVisuals/TitleId). Title::from_manifest then finds no title id and no quota.

run.rs goes on with title id 00000000 and a 0-byte storage quota: the title's storage, saves and temporary files go under data/00000000/, with no warning. Only the title 00000000 line in the console hints at it.

What the fix does

A new helper, tag_end, ends a tag at the first > that is outside a "…" or '…' attribute value. Comments and CDATA sections are handled as before.

How it behaves after the fix

Manifests whose attribute values contain > give their real title id and storage quota. Manifests without one are read exactly as before.

Tests

  • The new test a_quoted_angle_bracket_does_not_end_its_tag has a > in a double-quoted and in a single-quoted attribute value before TitleId. It expects (0x639AA8DD, 64 MiB).
  • The existing manifest test still passes.

I ran cargo test --workspace on GitHub's windows-latest with Rust 1.98.1 from rust-toolchain.toml:

  • This PR: everything passes. victory-hle has 87 passed, the other crates have 0 failed.
  • The new test alone on main: it fails with title id and quota (0, 0) instead of (0x639AA8DD, 64 MiB).
  • I ran with --test-threads=1. With 4 threads, the shader crate's GPU tests sometimes crash on that runner (#181, #244).

Not tested: a real title's manifest with such a value.

Related: #112 and #337 also edit this file, a few lines further down. Neither conflicts with this change.

**@⁠Dufftwt** on GitHub · 2026-11-24 02:34 UTC · [original](https://github.com/Marvisak/VIctory/pull/359) `Dufftwt:fix/manifest-quoted-angle-bracket` → `main` · +25 −1 · 1 files · 1 commits · merged 2026-11-25 00:10 UTC ## What's wrong `runtime::elements` reads `MicrosoftGame.config` to get the title id (`Game/TitleId`) and the storage quota (`Game/PersistentLocalStorage/SizeMB`). It ends every tag at the tag's first `>`. XML allows `>` **unescaped inside an attribute value** (XML 1.0 §3.1: `AttValue ::= '"' ([^<&"] | Reference)* '"'`). So a manifest with, say: ```xml <ShellVisuals DefaultDisplayName="A > B" … /> <TitleId>639AA8DD</TitleId> ``` has its `ShellVisuals` tag cut short at `A `. The `/>` that closes the element is never seen, the element stays open, and every element after it is read as its child (`Game/ShellVisuals/TitleId`). `Title::from_manifest` then finds no title id and no quota. `run.rs` goes on with title id `00000000` and a 0-byte storage quota: the title's storage, saves and temporary files go under `data/00000000/`, with no warning. Only the `title 00000000` line in the console hints at it. ## What the fix does A new helper, `tag_end`, ends a tag at the first `>` that is **outside** a `"…"` or `'…'` attribute value. Comments and CDATA sections are handled as before. ## How it behaves after the fix Manifests whose attribute values contain `>` give their real title id and storage quota. Manifests without one are read exactly as before. ## Tests - The new test `a_quoted_angle_bracket_does_not_end_its_tag` has a `>` in a double-quoted and in a single-quoted attribute value before `TitleId`. It expects `(0x639AA8DD, 64 MiB)`. - The existing manifest test still passes. I ran `cargo test --workspace` on GitHub's `windows-latest` with Rust 1.98.1 from `rust-toolchain.toml`: - **This PR:** everything passes. `victory-hle` has 87 passed, the other crates have 0 failed. - **The new test alone on `main`:** it fails with title id and quota `(0, 0)` instead of `(0x639AA8DD, 64 MiB)`. - I ran with `--test-threads=1`. With 4 threads, the shader crate's GPU tests sometimes crash on that runner (#181, #244). **Not tested:** a real title's manifest with such a value. Related: #112 and #337 also edit this file, a few lines further down. Neither conflicts with this change.
The MicrosoftGame.config reader ended a tag at its first '>', but XML
allows '>' unescaped inside an attribute value. A value with one
(DefaultDisplayName="A > B") cut the tag short: its '/>' was never
seen, so the element stayed open and every element after it was read
as its child. Game/TitleId and the storage quota were then not found,
and the title ran as id 00000000 with no storage quota, its saves and
temporary files in that folder, without a warning.

A tag now ends at the first '>' outside quotes.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 04:00:43 +00:00
github manually merged commit d549b6397e into gh-pr/359/base 2026-11-26 04:00:45 +00:00
Author
Owner

@⁠jeremygold02 on GitHub · 2026-11-24 04:27 UTC · original

Tested PR #359 at head d549b6397e3f40e77f9da670344aa15f12b26abb (state at test time: OPEN). Pre-comment refresh: state OPEN, head unchanged at d549b6397e3f40e77f9da670344aa15f12b26abb.

  • cargo test --locked -p victory-hle a_quoted_angle_bracket_does_not_end_its_tag — passed (ok. 1 passed; 0 failed; 0 ignored; 0 measured; 86 filtered out; finished in 0.00s ); cases: runtime::tests::a_quoted_angle_bracket_does_not_end_its_tag.

Behavior covered: Checks quoted angle brackets do not terminate manifest tags and title/store/quota fields still parse.
Code: crates/victory-hle/src/runtime.rs

**@⁠jeremygold02** on GitHub · 2026-11-24 04:27 UTC · [original](https://github.com/Marvisak/VIctory/pull/359#issuecomment-7122032590) Tested PR #359 at head `d549b6397e3f40e77f9da670344aa15f12b26abb` (state at test time: OPEN). Pre-comment refresh: state OPEN, head unchanged at `d549b6397e3f40e77f9da670344aa15f12b26abb`. - `cargo test --locked -p victory-hle a_quoted_angle_bracket_does_not_end_its_tag` — passed (ok. 1 passed; 0 failed; 0 ignored; 0 measured; 86 filtered out; finished in 0.00s ); cases: runtime::tests::a_quoted_angle_bracket_does_not_end_its_tag. Behavior covered: Checks quoted angle brackets do not terminate manifest tags and title/store/quota fields still parse. Code: [crates/victory-hle/src/runtime.rs](https://github.com/Marvisak/VIctory/blob/d549b6397e3f40e77f9da670344aa15f12b26abb/crates/victory-hle/src/runtime.rs)
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory!359
No description provided.