From 9390ae99b204f9e699eeeb986dfbadd3a5925214 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Sun, 26 Jun 2022 22:38:47 +0200 Subject: [PATCH] Fix OOB access when stopping a sound that has invalid samples --- src/game/client/components/sounds.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/game/client/components/sounds.cpp b/src/game/client/components/sounds.cpp index cbeed17fd..ca3321216 100644 --- a/src/game/client/components/sounds.cpp +++ b/src/game/client/components/sounds.cpp @@ -228,10 +228,10 @@ void CSounds::Stop(int SetId) if(m_WaitForSoundJob || SetId < 0 || SetId >= g_pData->m_NumSounds) return; - CDataSoundset *pSet = &g_pData->m_aSounds[SetId]; - + const CDataSoundset *pSet = &g_pData->m_aSounds[SetId]; for(int i = 0; i < pSet->m_NumSounds; i++) - Sound()->Stop(pSet->m_aSounds[i].m_Id); + if(pSet->m_aSounds[i].m_Id != -1) + Sound()->Stop(pSet->m_aSounds[i].m_Id); } bool CSounds::IsPlaying(int SetId)