Alexandre Julliard : dmloader: Check for invalid class in EnableCache().

Alexandre Julliard julliard at winehq.org
Thu Jun 11 15:26:47 CDT 2020


Module: wine
Branch: master
Commit: 8d12efecc967a1593583713a5adcd593b9e2e299
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=8d12efecc967a1593583713a5adcd593b9e2e299

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Thu Jun 11 21:56:46 2020 +0200

dmloader: Check for invalid class in EnableCache().

Fixes a test failure with sone Mingw versions.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/dmloader/loader.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/dlls/dmloader/loader.c b/dlls/dmloader/loader.c
index c5f5094fab..b90584b09a 100644
--- a/dlls/dmloader/loader.c
+++ b/dlls/dmloader/loader.c
@@ -771,10 +771,12 @@ static HRESULT WINAPI IDirectMusicLoaderImpl_EnableCache(IDirectMusicLoader8 *if
     if (IsEqualGUID(class, &GUID_DirectMusicAllTypes))
         This->cache_class = enable ? ~0 : 0;
     else {
+        int idx = index_from_class(class);
+        if (idx == -1) return S_FALSE;
         if (enable)
-            This->cache_class |= 1 << index_from_class(class);
+            This->cache_class |= 1 << idx;
         else
-            This->cache_class &= ~(1 << index_from_class(class));
+            This->cache_class &= ~(1 << idx);
     }
 
     if (!enable)




More information about the wine-cvs mailing list