aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorliamwhite <[email protected]>2022-07-28 11:02:41 -0400
committerGitHub <[email protected]>2022-07-28 11:02:41 -0400
commite5615c4704b9c39b140f4985bd0fa2ffc772125e (patch)
tree3e10c98c5ea1b31e3fb4828f9f7f7703b09b085c /src
parent1e3afd5d8046b284e2ed665ba1f16f51dd854127 (diff)
parent6c47b43a60d74e8e48de994b1d3a1ff7c6af7763 (diff)
downloadyuzu-android-e5615c4704b9c39b140f4985bd0fa2ffc772125e.tar.gz
yuzu-android-e5615c4704b9c39b140f4985bd0fa2ffc772125e.zip
Merge pull request #8657 from Kelebek1/depop
[Audio] Avoid an out-of-bounds span write in depop prepare
Diffstat (limited to 'src')
-rw-r--r--src/audio_core/renderer/command/command_buffer.cpp2
-rw-r--r--src/audio_core/renderer/command/mix/depop_prepare.cpp2
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 40074cf14..2ef879ee1 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<DepopPrepareCommand>(cmd);
}
diff --git a/src/audio_core/renderer/command/mix/depop_prepare.cpp b/src/audio_core/renderer/command/mix/depop_prepare.cpp
index 2ee076ef6..69bb78ccc 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<s32*>(previous_samples)};
- auto buffer{std::span(reinterpret_cast<s32*>(depop_buffer), buffer_count)};
+ auto buffer{reinterpret_cast<s32*>(depop_buffer)};
for (u32 i = 0; i < buffer_count; i++) {
if (samples[i]) {