From 6b176f8ff50becc85241587fbeb376079643d0a3 Mon Sep 17 00:00:00 2001 From: Andrea Date: Sun, 5 Feb 2023 21:03:37 +0000 Subject: [PATCH] Mockingboard: fix out of bounds access. (PR #1177) --- source/Mockingboard.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/source/Mockingboard.cpp b/source/Mockingboard.cpp index 8a7bc810..b84e0b16 100644 --- a/source/Mockingboard.cpp +++ b/source/Mockingboard.cpp @@ -67,7 +67,7 @@ MockingboardCard::MockingboardCard(UINT slot, SS_CARDTYPE type) : Card(type, slo m_lastAYUpdateCycle = 0; for (UINT i = 0; i < NUM_VOICES; i++) - m_ppAYVoiceBuffer[NUM_VOICES] = NULL; + m_ppAYVoiceBuffer[i] = new short[MAX_SAMPLES]; // Buffer can hold a max of 0.37 seconds worth of samples (16384/44100) m_inActiveCycleCount = 0; m_regAccessedFlag = false; @@ -88,9 +88,6 @@ MockingboardCard::MockingboardCard(UINT slot, SS_CARDTYPE type) : Card(type, slo m_syncEvent[id] = new SyncEvent(syncId, 0, MB_SyncEventCallback); } - for (UINT i = 0; i < NUM_VOICES; i++) - m_ppAYVoiceBuffer[i] = new short[MAX_SAMPLES]; // Buffer can hold a max of 0.37 seconds worth of samples (16384/44100) - for (UINT i = 0; i < NUM_SUBUNITS_PER_MB; i++) { m_MBSubUnit[i].nAY8910Number = i;