Reject XMA frame starts outside the announcing packet #2694
No reviewers
Labels
No labels
accessibility
area: build
area: formats
area: gpu
area: loader
area: runtime
area: shader
bug
documentation
duplicate
enhancement
good first issue
gpu: amd
gpu: intel
gpu: nvidia
help wanted
host: wine
invalid
out of scope
question
request
run report
triage: confirmed
triage: has patch
triage: merge candidate
triage: needs info
triage: needs rebase
triage: needs work
triage: proposed close
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/Marvisak--VIctory!2694
Loading…
Reference in a new issue
No description provided.
Delete branch "github-bot/gh-2694"
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?
@VlREX on GitHub · 2026-11-25 18:22 UTC · original
VlREX:fix/xma-frame-offset→main· +15 −1 · 1 files · 1 commits · openWhen 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.
@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.
@fuzeofficlal on GitHub · 2026-11-25 18:51 UTC · original
Independent Windows 11 verification and boundary review of
1cd96506(on13f91ca):Verification (
rustc 1.98.1MSVC)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 (includingxma::tests::next_frame_stays_in_the_packet_that_announces_it).cargo test --locked -p victory-hle: 146 passed, 0 failed (lib), plusfidelityfxandno_dll_plantingintegration checks clean.Review Notes
HEADER_BITS + header.first_frame_bit as usize >= PACKET_BITScleanly rejects offsets>= 16352(which previously landed directly on(next + 1) * PACKET_BITS, i.e., the next packet's 32-bit header) while still allowingfirst_frame_bit == 16351(last payload bit of the announcing packet) and keeping the existing(end / 8 < data.len())truncation check intact.packet(data, next)?already boundsnext) and empty/truncated buffers.@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=2and 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.origin/main(git grep), so the targeted run is not a pre-existing test.offset >= PACKET_BITSguard rejects a frame start outside its announcing packet before computingend, and the synthetic 3-packet case exercises it.No blocking findings. AI-assisted (Hy4 flash).
@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 returnsNone. 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:
checkpassing on this head.Generated by Claude Code
@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 base13f91ca).Tested
dxil.dllfrom Windows SDK 10.0.26100 (the loader's default), debug.cargo build --workspace --locked, thencargo 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.next_frame_stays_in_the_packet_that_announces_it.--skipleaves out tests that fail on main63bcca4on this card too, not because of this PR:heap_direct_texture_reads_mark_their_heap_indexends thevictory-shadertest process with0xc0000005(#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_viewsand the twostride_testshit the 1,000,000-view heap cap of NVIDIA drivers (#1835, #2317);gathers_at_a_level_match_the_hardwarefails on lane 0 (#1744).Not tested
AI use
@necrobytes on GitHub · 2026-11-25 18:29 UTC · original · reviewed
I checked
read_frame(...).nextat1cd9650with all 32,768 offsets the packet header can encode, across three synthetic layouts: adjacent packets, a skipped packet, and a zero-frame continuation with stream skips. The expected result was the announced bit position if it stayed in the announcing packet, otherwiseNone.On
13f91ca, the walker returned an out-of-packet start in 49,248 of the 98,304 cases. This head matched the expected result in all 98,304, including the last bit in the packet. The Linuxvictory-formatssuite also passed (39 passed, 5 ignored).AI-assisted review (Codex).
@fuzeofficlal on GitHub · 2026-11-27 02:26 UTC · original · approved these changes
Reviewed
1cd96506f944523fa506650c215041eda0131331.LGTM — checking
offset >= PACKET_BITS(HEADER_BITS + header.first_frame_bit as usize >= PACKET_BITS) innext_frameprevents malformedfirst_frame_bitvalues (includingPACKET_BITS - HEADER_BITSand the0x7FFFno-frame-start sentinel) from jumping into a subsequent packet's bits, while preserving the current frame withnext: None.Verified locally:
cargo xtask policy(191 files ok),cargo clippy -p victory-formats --all-targets/--all-features(-D warnings), and zero newrustfmtdiffs.cargo test -p victory-formats --locked xmapassed (21 passed, 3 ignored), includingnext_frame_stays_in_the_packet_that_announces_it.Non-blocking note:
HEADER_BITS + header.first_frame_bit as usizeexpressions atcrates/victory-formats/src/xma.rs:159(whenendlands mid-packet after a cross-packet frame) and the three test-walk callers do not yet enforce< PACKET_BITS.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.