You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In crates/xcl/src/hle/xaudio2.rs, submit_decoded_buffer submits each decoded buffer with the internal Box<DecodedBuffer> heap address (token) as XAUDIO2_BUFFER::pContext and stores it in voice_state.live_buffers.
When the title calls IXAudio2SourceVoice::GetState (get_state, lines 1138-1157):
If XAudio2's audio thread completes that buffer and runs decoded_cb_buffer_end (lines 611-617, which removes token from live_buffers and drops the Box<DecodedBuffer>) between orig(this, state_out, flags) and voice_state.live_buffers.lock(), then live_buffers.get(&cur) returns None. get_state leaves (*state_out).current_buffer_context set to the freed internal DecodedBuffer pointer instead of the title's orig_context or null, causing a use-after-free / type-confusion crash if the title dereferences pCurrentBufferContext.
Suggested fix
Clear current_buffer_context to null when the token is no longer in live_buffers (or look it up in a small recently-ended ring):
if cur != 0{(*state_out).current_buffer_context = voice_state
.live_buffers.lock().unwrap().get(&cur).map(|buf| buf.orig_contextas*mutc_void).unwrap_or(std::ptr::null_mut());}
Not tested
Read from commit 082944135cd2b96288470a595861fa608eee08dc without a new runtime test.
AI use
Antigravity harness (Gemini 4 Neon) audited xaudio2.rs and drafted this report; the author reviewed it before posting.
Claiming #2386: fixing the IXAudio2SourceVoice::GetState race on pCurrentBufferContext (crates/xcl/src/hle/xaudio2.rs) with a deterministic failing-first CPU unit test, then queuing the paired RX 7800 XT smoke run before opening the PR.
AI use: Claude Code (Claude Sonnet 5.5) will implement, test, and draft the PR.
Releasing claim on #2386 — competing PR #2410 already implements this fix with a unit test and paired smoke run.
AI use: orchestrated via Antigravity / Claude Sonnet 5.5.
Activity
oni-swr commentedon Nov 25, 2026
Claiming #2386: fixing the
IXAudio2SourceVoice::GetStaterace onpCurrentBufferContext(crates/xcl/src/hle/xaudio2.rs) with a deterministic failing-first CPU unit test, then queuing the paired RX 7800 XT smoke run before opening the PR.AI use: Claude Code (Claude Sonnet 5.5) will implement, test, and draft the PR.
XAudio2: GetState keeps the title's context for a buffer that just ended
oni-swr commentedon Nov 25, 2026
Releasing claim on #2386 — competing PR #2410 already implements this fix with a unit test and paired smoke run.
AI use: orchestrated via Antigravity / Claude Sonnet 5.5.
XAudio2: GetState keeps the title's context for a buffer that just ended
XAudio2: GetState keeps the title's context for a buffer that just ended