From 0c1759a75bdc60f5e836b031bb0896f3cf68f8c9 Mon Sep 17 00:00:00 2001 From: liushuyu Date: Wed, 27 Jul 2022 17:23:43 -0600 Subject: [PATCH] patch: fix audio related crashes --- ...b43a60d74e8e48de994b1d3a1ff7c6af7763.patch | 36 +++++++++++++++++++ org.yuzu_emu.yuzu.json | 4 +++ 2 files changed, 40 insertions(+) create mode 100644 6c47b43a60d74e8e48de994b1d3a1ff7c6af7763.patch diff --git a/6c47b43a60d74e8e48de994b1d3a1ff7c6af7763.patch b/6c47b43a60d74e8e48de994b1d3a1ff7c6af7763.patch new file mode 100644 index 0000000..d631bd8 --- /dev/null +++ b/6c47b43a60d74e8e48de994b1d3a1ff7c6af7763.patch @@ -0,0 +1,36 @@ +From 6c47b43a60d74e8e48de994b1d3a1ff7c6af7763 Mon Sep 17 00:00:00 2001 +From: Kelebek1 +Date: Wed, 27 Jul 2022 23:17:18 +0100 +Subject: [PATCH] Avoid depop out of bounds + +--- + src/audio_core/renderer/command/command_buffer.cpp | 2 +- + src/audio_core/renderer/command/mix/depop_prepare.cpp | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/audio_core/renderer/command/command_buffer.cpp b/src/audio_core/renderer/command/command_buffer.cpp +index 40074cf14ac..2ef879ee185 100644 +--- a/src/audio_core/renderer/command/command_buffer.cpp ++++ b/src/audio_core/renderer/command/command_buffer.cpp +@@ -339,7 +339,7 @@ void CommandBuffer::GenerateDepopPrepareCommand(const s32 node_id, const VoiceSt + cmd.previous_samples = memory_pool->Translate(CpuAddr(voice_state.previous_samples.data()), + MaxMixBuffers * sizeof(s32)); + cmd.buffer_count = buffer_count; +- cmd.depop_buffer = memory_pool->Translate(CpuAddr(buffer.data()), buffer_count * sizeof(s32)); ++ cmd.depop_buffer = memory_pool->Translate(CpuAddr(buffer.data()), buffer.size_bytes()); + + GenerateEnd(cmd); + } +diff --git a/src/audio_core/renderer/command/mix/depop_prepare.cpp b/src/audio_core/renderer/command/mix/depop_prepare.cpp +index 2ee076ef6b2..69bb78ccc80 100644 +--- a/src/audio_core/renderer/command/mix/depop_prepare.cpp ++++ b/src/audio_core/renderer/command/mix/depop_prepare.cpp +@@ -19,7 +19,7 @@ void DepopPrepareCommand::Dump([[maybe_unused]] const ADSP::CommandListProcessor + + void DepopPrepareCommand::Process(const ADSP::CommandListProcessor& processor) { + auto samples{reinterpret_cast(previous_samples)}; +- auto buffer{std::span(reinterpret_cast(depop_buffer), buffer_count)}; ++ auto buffer{reinterpret_cast(depop_buffer)}; + + for (u32 i = 0; i < buffer_count; i++) { + if (samples[i]) { diff --git a/org.yuzu_emu.yuzu.json b/org.yuzu_emu.yuzu.json index a9ea44b..7a8235b 100644 --- a/org.yuzu_emu.yuzu.json +++ b/org.yuzu_emu.yuzu.json @@ -265,6 +265,10 @@ { "type": "file", "path": "compatibility_list.json" + }, + { + "type": "patch", + "path": "6c47b43a60d74e8e48de994b1d3a1ff7c6af7763.patch" } ] }