Andrew Eikum : xaudio2: Protect access to submix voice during creation ( Coverity).

Alexandre Julliard julliard at winehq.org
Thu Jun 16 03:45:39 CDT 2016


Module: wine
Branch: stable
Commit: a81e1ad8477ea45f39186345f40253e9fddeba2d
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=a81e1ad8477ea45f39186345f40253e9fddeba2d

Author: Andrew Eikum <aeikum at codeweavers.com>
Date:   Wed Feb 10 12:54:40 2016 -0600

xaudio2: Protect access to submix voice during creation (Coverity).

Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit 7bb885a3d3ac4fdc435fc79fc5632b6b9e70ffa7)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>

---

 dlls/xaudio2_7/xaudio_dll.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/dlls/xaudio2_7/xaudio_dll.c b/dlls/xaudio2_7/xaudio_dll.c
index 2f750bd..3bb1aad 100644
--- a/dlls/xaudio2_7/xaudio_dll.c
+++ b/dlls/xaudio2_7/xaudio_dll.c
@@ -1467,8 +1467,10 @@ static HRESULT WINAPI IXAudio2Impl_CreateSubmixVoice(IXAudio2 *iface,
     EnterCriticalSection(&This->lock);
 
     LIST_FOR_EACH_ENTRY(sub, &This->submix_voices, XA2SubmixImpl, entry){
+        EnterCriticalSection(&sub->lock);
         if(!sub->in_use)
             break;
+        LeaveCriticalSection(&sub->lock);
     }
 
     if(&sub->entry == &This->submix_voices){
@@ -1486,11 +1488,14 @@ static HRESULT WINAPI IXAudio2Impl_CreateSubmixVoice(IXAudio2 *iface,
 
         InitializeCriticalSection(&sub->lock);
         sub->lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": XA2SubmixImpl.lock");
+
+        EnterCriticalSection(&sub->lock);
     }
 
     sub->in_use = TRUE;
 
     LeaveCriticalSection(&This->lock);
+    LeaveCriticalSection(&sub->lock);
 
 #if XAUDIO2_VER == 0
     *ppSubmixVoice = (IXAudio2SubmixVoice*)&sub->IXAudio20SubmixVoice_iface;




More information about the wine-cvs mailing list