HLE: decode numeric character references in manifests #2606

Open
github-bot wants to merge 1 commit from github-bot/gh-2606 into main AGit
Owner

@⁠XeNS1 on GitHub · 2026-11-25 16:43 UTC · original
XeNS1:codex/manifest-character-references-20261125 → main · +133 −7 · 1 files · 1 commits · open

Title::from_manifest recognizes predefined XML entities but leaves numeric character references encoded. For example, XML-equivalent 0012ABCD and 0012ABCD currently produce different title IDs: the latter becomes zero. Encoded SizeMB also becomes zero, and StoreId retains the reference spelling.

Decode decimal and hexadecimal character references alongside the existing five predefined entities, once. Accept only XML 1.0 character values; keep malformed/unknown references literal, as the existing permissive reader does. Trim the resulting field text so numeric whitespace references behave like literal whitespace. No dependencies added.

Claim: decode numeric XML character references in manifest fields. #1196 changes self-closing element ownership in the same function; this does not implement that fix. #337's quota-overflow fix is also outside this scope.

Validation on Linux x86-64, Rust 1.100.0:

  • The actual crates/victory-hle/src/runtime.rs module can compile standalone on Linux using only std. rustc --edition=2024 --test crates/victory-hle/src/runtime.rs -o /tmp/victory-runtime-tests, then /tmp/victory-runtime-tests --test-threads=2: 7 passed. All 3 existing tests pass. Four new tests cover equivalent manifest fields, one-pass decoding, 21 malformed/unknown cases, and 9 XML character-range boundaries in both decimal and hex form.
  • Negative control with original production code and the new tests: 4 passed, 3 failed, including encoded title ID/quota incorrectly becoming zero.
  • Standalone module Clippy: clippy-driver --edition=2024 --test crates/victory-hle/src/runtime.rs -D warnings -o /tmp/victory-runtime-clippy-tests passes; its 7 tests pass too.
  • rustfmt --edition=2024 --check crates/victory-hle/src/runtime.rs, git diff --check, and asset policy (184 repository files / 1 staged file) pass.

The full HLE crate/workspace and the pinned Rust 1.98.1 toolchain were not run locally; repository Windows CI is the integration check. All new manifests are source-written synthetic strings. No game files were accessed, included or executed.

Reference: XML 1.0 Char and CharRef productions.

AI-assisted implementation and validation: OpenAI Codex.

**@⁠XeNS1** on GitHub · 2026-11-25 16:43 UTC · [original](https://github.com/Marvisak/VIctory/pull/2606) `XeNS1:codex/manifest-character-references-20261125` → `main` · +133 −7 · 1 files · 1 commits · open `Title::from_manifest` recognizes predefined XML entities but leaves numeric character references encoded. For example, XML-equivalent `0012ABCD` and `0012ABCD` currently produce different title IDs: the latter becomes zero. Encoded `SizeMB` also becomes zero, and `StoreId` retains the reference spelling. Decode decimal and hexadecimal character references alongside the existing five predefined entities, once. Accept only XML 1.0 character values; keep malformed/unknown references literal, as the existing permissive reader does. Trim the resulting field text so numeric whitespace references behave like literal whitespace. No dependencies added. Claim: [decode numeric XML character references in manifest fields](https://git.gtahub.st/github/Marvisak--VIctory/issues/1633). #1196 changes self-closing element ownership in the same function; this does not implement that fix. #337's quota-overflow fix is also outside this scope. Validation on Linux x86-64, Rust 1.100.0: - The actual `crates/victory-hle/src/runtime.rs` module can compile standalone on Linux using only std. `rustc --edition=2024 --test crates/victory-hle/src/runtime.rs -o /tmp/victory-runtime-tests`, then `/tmp/victory-runtime-tests --test-threads=2`: **7 passed**. All 3 existing tests pass. Four new tests cover equivalent manifest fields, one-pass decoding, 21 malformed/unknown cases, and 9 XML character-range boundaries in both decimal and hex form. - Negative control with original production code and the new tests: **4 passed, 3 failed**, including encoded title ID/quota incorrectly becoming zero. - Standalone module Clippy: `clippy-driver --edition=2024 --test crates/victory-hle/src/runtime.rs -D warnings -o /tmp/victory-runtime-clippy-tests` passes; its 7 tests pass too. - `rustfmt --edition=2024 --check crates/victory-hle/src/runtime.rs`, `git diff --check`, and asset policy (184 repository files / 1 staged file) pass. The full HLE crate/workspace and the pinned Rust 1.98.1 toolchain were not run locally; repository Windows CI is the integration check. All new manifests are source-written synthetic strings. No game files were accessed, included or executed. Reference: XML 1.0 [Char](https://www.w3.org/TR/xml/#charsets) and [CharRef](https://www.w3.org/TR/xml/#sec-references) productions. AI-assisted implementation and validation: OpenAI Codex.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:10:11 +00:00
Author
Owner

@⁠kotekompotek on GitHub · 2026-11-25 17:43 UTC · original

Reviewed: reference() decodes the five predefined entities plus &#N;/&#xN; and correctly excludes NUL/controls/surrogates/U+FFFE/U+FFFF per XML's Char production. decode_references is genuinely single-pass — a decoded & in the output is not re-expanded. CI green.

**@⁠kotekompotek** on GitHub · 2026-11-25 17:43 UTC · [original](https://github.com/Marvisak/VIctory/pull/2606#issuecomment-7169919361) Reviewed: `reference()` decodes the five predefined entities plus `&#N;`/`&#xN;` and correctly excludes NUL/controls/surrogates/U+FFFE/U+FFFF per XML's Char production. `decode_references` is genuinely single-pass — a decoded `&` in the output is not re-expanded. CI green.
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 23:19 UTC · original

Automated triage for the maintainers.

This replaces the five-entity replace fold in elements (crates/victory-hle/src/runtime.rs) with a single-pass decode_references that also decodes decimal/hex character references, restricted to XML 1.0's Char range, leaving malformed or unknown references literal. I checked that decoding is genuinely one pass (a decoded & is not re-expanded), that only lowercase x is accepted as XML requires, and that the existing comment-skipping in field_text still composes with it; the new tests cover equivalence with plain text, single-pass behaviour, malformed references and range boundaries. CI: check passing.

This is a recommendation for a maintainer to look, not an approval.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 23:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/2606#issuecomment-7177419056) <!-- victory-triage v1 head=e2201b0449ee3f04f551c0680bfc858f742adf9e verdict=merge-candidate at=2026-11-25T23:19:46Z --> Automated triage for the maintainers. This replaces the five-entity `replace` fold in `elements` (crates/victory-hle/src/runtime.rs) with a single-pass `decode_references` that also decodes decimal/hex character references, restricted to XML 1.0's Char range, leaving malformed or unknown references literal. I checked that decoding is genuinely one pass (a decoded `&#38;` is not re-expanded), that only lowercase `x` is accepted as XML requires, and that the existing comment-skipping in `field_text` still composes with it; the new tests cover equivalence with plain text, single-pass behaviour, malformed references and range boundaries. CI: `check` passing. This is a recommendation for a maintainer to look, not an approval. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

@⁠futurepro62 on GitHub · 2026-11-26 01:29 UTC · original

Full-suite run on NVIDIA, since this PR has no test report yet. Tested exact head e2201b0 (on its base 67e8ae1).

Tested

  • NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC (pinned), dxil.dll from Windows SDK 10.0.26100 (the loader's default), debug.
  • cargo build --workspace --locked, then cargo 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: 777 passed, 0 failed, 9 ignored.
  • The new tests ran and passed: numeric_references_preserve_manifest_fields, manifest_references_are_decoded_once, invalid_manifest_references_stay_literal, xml_character_reference_boundaries.
  • --skip leaves out tests that fail on main 63bcca4 on this card too, not because of this PR: heap_direct_texture_reads_mark_their_heap_index ends the victory-shader test process with 0xc0000005 (#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_views and the two stride_tests hit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317); gathers_at_a_level_match_the_hardware fails on lane 0 (#1744).

Not tested

  • AMD (the tests take the default adapter), a release build, the title (test run only).

AI use

  • Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
**@⁠futurepro62** on GitHub · 2026-11-26 01:29 UTC · [original](https://github.com/Marvisak/VIctory/pull/2606#issuecomment-7179818710) Full-suite run on NVIDIA, since this PR has no test report yet. Tested exact head `e2201b0` (on its base `67e8ae1`). **Tested** - NVIDIA GeForce RTX 5070 Ti 16 GB (Blackwell, 32-lane waves only, mesh shaders), driver 621.40, Ryzen 7 9800X3D, Windows 11 Home 26300, Rust 1.98.1 MSVC (pinned), `dxil.dll` from Windows SDK 10.0.26100 (the loader's default), debug. - `cargo build --workspace --locked`, then `cargo 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`: **777 passed, 0 failed, 9 ignored**. - The new tests ran and passed: `numeric_references_preserve_manifest_fields`, `manifest_references_are_decoded_once`, `invalid_manifest_references_stay_literal`, `xml_character_reference_boundaries`. - `--skip` leaves out tests that fail on main `63bcca4` on this card too, not because of this PR: `heap_direct_texture_reads_mark_their_heap_index` ends the `victory-shader` test process with `0xc0000005` (#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_views` and the two `stride_tests` hit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317); `gathers_at_a_level_match_the_hardware` fails on lane 0 (#1744). **Not tested** - AMD (the tests take the default adapter), a release build, the title (test run only). **AI use** - Claude Code (Claude Opus 5.5) ran the tests and wrote this report. I checked it before posting.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-26 16:12 UTC · original · approved these changes

Reviewed e2201b0449ee3f04f551c0680bfc858f742adf9e (merged cleanly onto 63bcca43c6a00a758510398fa43096ce7e4f7df0) and verified on Windows 11 x64 (rustc 1.98.1 MSVC).

Audit

  • crates/victory-hle/src/runtime.rs:142, :178, :231:
    • reference decodes the five predefined XML entities and XML 1.0 decimal/lowercase-hex numeric character references (&#...; / &#x...;), rejecting uppercase &#X, signs (+/-), empty digits, u32 overflow, NUL, disallowed control characters, surrogates (0xD800..=0xDFFF), U+FFFE/U+FFFF, and out-of-range code points per XML 1.0 Char.
    • decode_references is strictly single-pass (split('&') + split_once(';') appending straight to out), so decoded references such as &#38;lt; or &amp;#65; are never re-expanded, malformed/unterminated references stay literal, and .trim() after decoding normalizes whitespace references like &#32; / &#x9; / &#10;.

Verification

  • Clean merge onto 63bcca43c6a00a758510398fa43096ce7e4f7df0 + cargo run -p xtask -- policy (191 files ok)
  • cargo clippy -p victory-hle --all-targets -- -D warnings (default & --all-features)
  • cargo test -p victory-hle --lib -- runtime::: 8/8 passed (including all four new manifest reference tests).
  • Additional probe verified long leading-zero references (&#0000000000000000000065;, &#x0000000000000042;), consecutive ampersands and extra semicolons (&&amp;, a&b&lt;c, &#65;;), double-decode traps (&#38;#65;, &#x26;lt;, &amp;#x41;), all 29 disallowed XML 1.0 control code points, surrogates, and noncharacters.
**@⁠fuzeofficlal** on GitHub · 2026-11-26 16:12 UTC · [original](https://github.com/Marvisak/VIctory/pull/2606#pullrequestreview-6077338908) · **approved these changes** Reviewed `e2201b0449ee3f04f551c0680bfc858f742adf9e` (merged cleanly onto `63bcca43c6a00a758510398fa43096ce7e4f7df0`) and verified on Windows 11 x64 (`rustc 1.98.1` MSVC). ### Audit - `crates/victory-hle/src/runtime.rs:142`, `:178`, `:231`: - `reference` decodes the five predefined XML entities and XML 1.0 decimal/lowercase-hex numeric character references (`&#...;` / `&#x...;`), rejecting uppercase `&#X`, signs (`+`/`-`), empty digits, `u32` overflow, NUL, disallowed control characters, surrogates (`0xD800..=0xDFFF`), `U+FFFE`/`U+FFFF`, and out-of-range code points per XML 1.0 `Char`. - `decode_references` is strictly single-pass (`split('&')` + `split_once(';')` appending straight to `out`), so decoded references such as `&#38;lt;` or `&amp;#65;` are never re-expanded, malformed/unterminated references stay literal, and `.trim()` after decoding normalizes whitespace references like `&#32;` / `&#x9;` / `&#10;`. ### Verification - Clean merge onto `63bcca43c6a00a758510398fa43096ce7e4f7df0` + `cargo run -p xtask -- policy` (`191 files ok`) - `cargo clippy -p victory-hle --all-targets -- -D warnings` (default & `--all-features`) - `cargo test -p victory-hle --lib -- runtime::`: **8/8 passed** (including all four new manifest reference tests). - Additional probe verified long leading-zero references (`&#0000000000000000000065;`, `&#x0000000000000042;`), consecutive ampersands and extra semicolons (`&&amp;`, `a&b&lt;c`, `&#65;;`), double-decode traps (`&#38;#65;`, `&#x26;lt;`, `&amp;#x41;`), all 29 disallowed XML 1.0 control code points, surrogates, and noncharacters.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2606/head:github-bot/gh-2606'
git switch 'github-bot/gh-2606'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2606'
git switch 'github-bot/gh-2606'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2606'
git switch 'github-bot/gh-2606'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2606'
git switch 'main'
git merge --squash 'github-bot/gh-2606'
git switch 'main'
git merge --ff-only 'github-bot/gh-2606'
git switch 'main'
git merge 'github-bot/gh-2606'
git push origin 'main'
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!2606
No description provided.