prevent out of bounds access for microphone data

This commit is contained in:
RSDuck 2024-11-18 18:58:14 +01:00
parent 0ea0af3abf
commit c01b2bf7a0
1 changed files with 5 additions and 1 deletions

View File

@ -330,7 +330,11 @@ void EmuInstance::micProcess()
micBufferReadPos += len; micBufferReadPos += len;
} }
if (len < kFrameLen) if (len == 0)
{
memset(tmp, 0, sizeof(tmp));
}
else if (len < kFrameLen)
{ {
for (int i = len; i < kFrameLen; i++) for (int i = len; i < kFrameLen; i++)
tmp[i] = tmp[len-1]; tmp[i] = tmp[len-1];