Skip to content

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

Merged
Marvisak merged 1 commit into
Marvisak:mainfrom
Dufftwt:fix/manifest-quoted-angle-bracket
Nov 25, 2026
Merged

Marvisak merged 1 commit into
Marvisak:mainfrom
Dufftwt:fix/manifest-quoted-angle-bracket

Conversation

@Dufftwt

@Dufftwt Dufftwt commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

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:

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.
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
… its tag

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jeremygold02

Copy link
Copy Markdown
Contributor

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

@ghost ghost mentioned this pull request Nov 24, 2026

@mercuryVM mercuryVM left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested d549b63 on Windows 11, RTX 5070, MSVC: cargo test --workspace --no-fail-fast passes (265 passed, 0 failed).

  • XML 1.0 allows a raw > in an attribute value, so the old find('>') was wrong for any manifest with one. tag_end tracks " and ' and only ends the tag on an unquoted >.
  • I checked the cases that could regress:
    • Comments and CDATA are still split off before tag_end (the <!-- and <![CDATA[ arms), so an apostrophe in a comment can't start a "quote".
    • <?xml version="1.0"?> and similar declarations have balanced quotes.
    • Element text isn't scanned by tag_end at all.

No issues found.

AI-assisted (Claude Code).

mercuryVM added a commit to mercuryVM/VIctory that referenced this pull request Nov 24, 2026
…bute does not end its tag

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 24, 2026
github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 24, 2026
github-actions Bot added a commit to KevinPratap/VIctory that referenced this pull request Nov 24, 2026
@Marvisak
Marvisak merged commit 8595259 into Marvisak:main Nov 25, 2026
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.

4 participants