XMA: end a frame at its data instead of looping forever (port of VIctory#183) #40
No reviewers
Labels
No labels
accessibility
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
github/uiliannn--VItoriaBr!40
Loading…
Reference in a new issue
No description provided.
Delete branch "gh-pr/40/head"
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?
@lcg007xd-c on GitHub · 2026-11-25 20:08 UTC · original
lcg007xd-c:port/xma-noise-hang→main· +238 −1 · 1 files · 1 commits · merged 2026-11-25 20:33 UTCPort of Marvisak/VIctory#183 by AnoHunted, cherry-picked with
-x, so the commit keeps its author. VItoriaBr's issue #4 lists338808eas a sync candidate, butmaindoesn't have it yet.What it fixes
Decoder::decodebounds a frame by its header's bit count, not by the bytes it was given. A frame whose bit count runs past the data loops forever. The fix is one line incrates/victory-formats/src/xma.rs(end: bits.min(data.len().saturating_mul(8))). The rest is upstream's noise tests.In the game,
victory-hle's caller passesframe.bitsfromread_frame, so this hardens the decoder against bad streams. I haven't seen it hang in a real run.Tested (Linux, Rust 1.98.1)
mainwithout conflicts.cargo test -p victory-formats --locked xma: 10 passed, 2 ignored.noise_frames_with_bit_counts_past_the_datahangs: still running after 60 s, killed at 120 s.cargo clippy -p victory-formats --all-targets --locked -- -D warnings: clean.Note: until #39 is in, the portable CI job stays red for an unrelated reason (an unused variable in the POPS test).
🤖 Generated with Claude Code