Added dmime-PChannel-range patchset

This commit is contained in:
Alistair Leslie-Hughes
2019-09-19 11:41:36 +10:00
parent ccdf3d98ff
commit fab929969c
3 changed files with 67 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
From 6a4d40b86f94703f8c37264739fffc4885507ebf Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Tue, 17 Sep 2019 16:21:22 +1000
Subject: [PATCH] dmime: Ensure Channels are in range before assignment.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=17766
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=24740
---
dlls/dmime/performance.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/dlls/dmime/performance.c b/dlls/dmime/performance.c
index 6e4dae6be7..3bbbb3b853 100644
--- a/dlls/dmime/performance.c
+++ b/dlls/dmime/performance.c
@@ -34,7 +34,7 @@ typedef struct IDirectMusicPerformance8Impl {
float fMasterTempo;
long lMasterVolume;
/* performance channels */
- DMUSIC_PRIVATE_PCHANNEL PChannel[32];
+ DMUSIC_PRIVATE_PCHANNEL PChannel[256];
/* IDirectMusicPerformance8Impl fields */
IDirectMusicAudioPath *pDefaultPath;
HANDLE hNotification;
@@ -624,6 +624,9 @@ static HRESULT WINAPI IDirectMusicPerformance8Impl_AssignPChannelBlock(IDirectMu
FIXME("(%p, %d, %p, %d): semi-stub\n", This, dwBlockNum, pPort, dwGroup-1);
if (NULL == pPort) return E_POINTER;
+ if (dwBlockNum > ARRAY_SIZE(This->PChannel))
+ return S_FALSE;
+
range = 16 * dwBlockNum;
j = 0;
for (i = range; i < range+16; i++) {
@@ -633,7 +636,6 @@ static HRESULT WINAPI IDirectMusicPerformance8Impl_AssignPChannelBlock(IDirectMu
This->PChannel[i].channel = j; /* FIXME: should this be assigned? */
j++;
}
- /*if (dwGroup > 2) return S_FALSE;*/
return S_OK;
}
--
2.17.1

View File

@@ -0,0 +1,2 @@
Fixes: [17766] Empire Earth crashes on start without native directmusic
Fixes: [24740] Trinklet Supreme crashes on startup