From 12005acc985a10244af6ee7b99a96827cf029362 Mon Sep 17 00:00:00 2001 From: Gliniak Date: Sun, 27 Nov 2022 18:40:27 +0100 Subject: [PATCH] [APU] Check if splitted frame length is valid --- src/xenia/apu/xma_context.cc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/xenia/apu/xma_context.cc b/src/xenia/apu/xma_context.cc index 1c74fd357..030be2536 100644 --- a/src/xenia/apu/xma_context.cc +++ b/src/xenia/apu/xma_context.cc @@ -492,10 +492,20 @@ void XmaContext::Decode(XMA_CONTEXT_DATA* data) { } if (frame_count > 0) { - assert_true(xma::GetPacketFrameOffset(packet) - 32 == - split_frame_len_ - split_frame_len_partial_); + //assert_true(xma::GetPacketFrameOffset(packet) - 32 == + // split_frame_len_ - split_frame_len_partial_); } + if (split_frame_len_partial_ > split_frame_len_) { + XELOGAPU( + "XmaContext {}: Invalid split frame lengths {}! frame_length: {} " + "partial_length: {}", + id(), split_frame_len_, split_frame_len_partial_); + split_frame_len_ = 0; + split_frame_len_partial_ = 0; + SwapInputBuffer(data); + return; + } auto offset = stream.Copy( xma_frame_.data() + 1 + ((split_frame_len_partial_ + split_frame_padding_start_) / 8),