From c01b2bf7a04a1ab153207b5d1b87ab5f6cb4e020 Mon Sep 17 00:00:00 2001 From: RSDuck Date: Mon, 18 Nov 2024 18:58:14 +0100 Subject: [PATCH] prevent out of bounds access for microphone data --- src/frontend/qt_sdl/EmuInstanceAudio.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/frontend/qt_sdl/EmuInstanceAudio.cpp b/src/frontend/qt_sdl/EmuInstanceAudio.cpp index 4952d090..a4ac9394 100644 --- a/src/frontend/qt_sdl/EmuInstanceAudio.cpp +++ b/src/frontend/qt_sdl/EmuInstanceAudio.cpp @@ -330,7 +330,11 @@ void EmuInstance::micProcess() micBufferReadPos += len; } - if (len < kFrameLen) + if (len == 0) + { + memset(tmp, 0, sizeof(tmp)); + } + else if (len < kFrameLen) { for (int i = len; i < kFrameLen; i++) tmp[i] = tmp[len-1];