Reject XMA frame starts outside the announcing packet #2694

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

@⁠VlREX on GitHub · 2026-11-25 18:22 UTC · original
VlREX:fix/xma-frame-offset → main · +15 −1 · 1 files · 1 commits · open

When an XMA2 header announces a frame at payload offset 16352, the frame walker returns the start of the following packet as an audio frame. Check the offset against the announcing packet before returning it. A synthetic three-packet regression test fails before the change (Some(32768) instead of None) and passes afterward.

Tested victory-formats on Windows with Rust 1.98.1 (GNU): 39 passed, 5 ignored. The full local workspace build was blocked by missing native build tools.

**@⁠VlREX** on GitHub · 2026-11-25 18:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/2694) `VlREX:fix/xma-frame-offset` → `main` · +15 −1 · 1 files · 1 commits · open When an XMA2 header announces a frame at payload offset 16352, the frame walker returns the start of the following packet as an audio frame. Check the offset against the announcing packet before returning it. A synthetic three-packet regression test fails before the change (Some(32768) instead of None) and passes afterward. Tested victory-formats on Windows with Rust 1.98.1 (GNU): 39 passed, 5 ignored. The full local workspace build was blocked by missing native build tools.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:12:14 +00:00
Author
Owner

@⁠kotekompotek on GitHub · 2026-11-25 18:50 UTC · original

Correct - an announced frame bit past the packet's payload can't belong to this packet, and returning None there also stops the walker from fabricating a frame at the next packet's start. The three-packet regression pins it.

**@⁠kotekompotek** on GitHub · 2026-11-25 18:50 UTC · [original](https://github.com/Marvisak/VIctory/pull/2694#issuecomment-7171463043) Correct - an announced frame bit past the packet's payload can't belong to this packet, and returning None there also stops the walker from fabricating a frame at the next packet's start. The three-packet regression pins it.
Author
Owner

@⁠fuzeofficlal on GitHub · 2026-11-25 18:51 UTC · original

Independent Windows 11 verification and boundary review of 1cd96506 (on 13f91ca):

Verification (rustc 1.98.1 MSVC)

  • cargo clippy --locked -p victory-formats -p victory-hle --all-targets -- -D warnings: 0 warnings.
  • cargo test --locked -p victory-formats: 39 passed, 0 failed, 5 ignored (including xma::tests::next_frame_stays_in_the_packet_that_announces_it).
  • cargo test --locked -p victory-hle: 146 passed, 0 failed (lib), plus fidelityfx and no_dll_planting integration checks clean.

Review Notes

  • Checking HEADER_BITS + header.first_frame_bit as usize >= PACKET_BITS cleanly rejects offsets >= 16352 (which previously landed directly on (next + 1) * PACKET_BITS, i.e., the next packet's 32-bit header) while still allowing first_frame_bit == 16351 (last payload bit of the announcing packet) and keeping the existing (end / 8 < data.len()) truncation check intact.
  • Safe against integer overflow (since packet(data, next)? already bounds next) and empty/truncated buffers.
**@⁠fuzeofficlal** on GitHub · 2026-11-25 18:51 UTC · [original](https://github.com/Marvisak/VIctory/pull/2694#issuecomment-7171499122) Independent Windows 11 verification and boundary review of `1cd96506` (on `13f91ca`): ### Verification (`rustc 1.98.1` MSVC) - `cargo clippy --locked -p victory-formats -p victory-hle --all-targets -- -D warnings`: **0 warnings**. - `cargo test --locked -p victory-formats`: **39 passed, 0 failed, 5 ignored** (including `xma::tests::next_frame_stays_in_the_packet_that_announces_it`). - `cargo test --locked -p victory-hle`: **146 passed, 0 failed** (`lib`), plus `fidelityfx` and `no_dll_planting` integration checks clean. ### Review Notes - Checking `HEADER_BITS + header.first_frame_bit as usize >= PACKET_BITS` cleanly rejects offsets `>= 16352` (which previously landed directly on `(next + 1) * PACKET_BITS`, i.e., the next packet's 32-bit header) while still allowing `first_frame_bit == 16351` (last payload bit of the announcing packet) and keeping the existing `(end / 8 < data.len())` truncation check intact. - Safe against integer overflow (since `packet(data, next)?` already bounds `next`) and empty/truncated buffers.
Author
Owner

@⁠cloph-dsp on GitHub · 2026-11-25 19:22 UTC · original

Independent CPU-only verification from Windows / rustc+cargo 1.100.0 (MSVC), with CARGO_BUILD_JOBS=2 and no game data, GPU, clippy or rustup:

  • cargo test --locked -p victory-formats --lib next_frame_stays_in_the_packet_that_announces_it --quiet -> 1 passed.
  • cargo test --locked -p victory-formats --lib --quiet -> 39 passed, 0 failed, 5 ignored.
  • Negative control: the new test name is absent from origin/main (git grep), so the targeted run is not a pre-existing test.
  • Reviewed the production hunk: the offset >= PACKET_BITS guard rejects a frame start outside its announcing packet before computing end, and the synthetic 3-packet case exercises it.

No blocking findings. AI-assisted (Hy4 flash).

**@⁠cloph-dsp** on GitHub · 2026-11-25 19:22 UTC · [original](https://github.com/Marvisak/VIctory/pull/2694#issuecomment-7172196108) Independent CPU-only verification from Windows / rustc+cargo 1.100.0 (MSVC), with `CARGO_BUILD_JOBS=2` and no game data, GPU, clippy or rustup: - `cargo test --locked -p victory-formats --lib next_frame_stays_in_the_packet_that_announces_it --quiet` -> 1 passed. - `cargo test --locked -p victory-formats --lib --quiet` -> 39 passed, 0 failed, 5 ignored. - Negative control: the new test name is absent from `origin/main` (`git grep`), so the targeted run is not a pre-existing test. - Reviewed the production hunk: the `offset >= PACKET_BITS` guard rejects a frame start outside its announcing packet before computing `end`, and the synthetic 3-packet case exercises it. No blocking findings. AI-assisted (Hy4 flash).
Author
Owner

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

Automated triage for the maintainers.

Merge candidate (recommend a look). In next_frame (crates/victory-formats/src/xma.rs), a packet header whose first-frame offset points past its own 16,352-bit payload used to produce a "next frame" at the following packet's header bits. Now it returns None. The check (HEADER_BITS + first_frame_bit >= PACKET_BITS) is the right boundary: offset 16,351 is still accepted. The synthetic three-packet test builds exactly that header and fails on main. Small and self-contained. It is only robustness for malformed or edge-case stream data; no title stream is shown to hit it.

CI: check passing on this head.


Generated by Claude Code

**@⁠Marvisak** on GitHub · 2026-11-25 22:19 UTC · [original](https://github.com/Marvisak/VIctory/pull/2694#issuecomment-7176229612) <!-- victory-triage v1 head=1cd96506f944523fa506650c215041eda0131331 verdict=merge-candidate at=2026-11-25T22:21:00Z --> Automated triage for the maintainers. **Merge candidate (recommend a look).** In `next_frame` (`crates/victory-formats/src/xma.rs`), a packet header whose first-frame offset points past its own 16,352-bit payload used to produce a "next frame" at the following packet's header bits. Now it returns `None`. The check (`HEADER_BITS + first_frame_bit >= PACKET_BITS`) is the right boundary: offset 16,351 is still accepted. The synthetic three-packet test builds exactly that header and fails on main. Small and self-contained. It is only robustness for malformed or edge-case stream data; no title stream is shown to hit it. CI: `check` passing on this head. --- _Generated by [Claude Code](https://claude.ai/code)_
Author
Owner

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

NVIDIA full-suite run, to go with the reports above by cloph-dsp, fuzeofficlal, necrobytes, since none of them names a GPU run. Tested exact head 1cd9650 (on its base 13f91ca).

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: 774 passed, 0 failed, 9 ignored.
  • The new tests ran and passed: next_frame_stays_in_the_packet_that_announces_it.
  • --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 11:48 UTC · [original](https://github.com/Marvisak/VIctory/pull/2694#issuecomment-7191187629) NVIDIA full-suite run, to go with the reports above by cloph-dsp, fuzeofficlal, necrobytes, since none of them names a GPU run. Tested exact head `1cd9650` (on its base `13f91ca`). **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`: **774 passed, 0 failed, 9 ignored**. - The new tests ran and passed: `next_frame_stays_in_the_packet_that_announces_it`. - `--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.
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/2694/head:github-bot/gh-2694'
git switch 'github-bot/gh-2694'

Merge

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