[PATCH] dmime: Don't crash when DMSegment loads a MIDI file

Michael Stefaniuc mstefani at winehq.org
Mon Jul 16 16:39:01 CDT 2018


Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=31829
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
 dlls/dmime/segment.c | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/dlls/dmime/segment.c b/dlls/dmime/segment.c
index dc460690f6..9a9872bd4c 100644
--- a/dlls/dmime/segment.c
+++ b/dlls/dmime/segment.c
@@ -790,10 +790,16 @@ static HRESULT WINAPI seg_IPersistStream_Load(IPersistStream *iface, IStream *st
     if (!stream)
         return E_POINTER;
 
-    if (stream_get_chunk(stream, &riff) != S_OK || riff.id != FOURCC_RIFF)
+    if (stream_get_chunk(stream, &riff) != S_OK ||
+            (riff.id != FOURCC_RIFF && riff.id != mmioFOURCC('M','T','h','d')))
         return DMUS_E_UNSUPPORTED_STREAM;
-
     stream_reset_chunk_start(stream, &riff);
+
+    if (riff.id == mmioFOURCC('M','T','h','d')) {
+        FIXME("MIDI file loading not supported\n");
+        return S_OK;
+    }
+
     hr = IDirectMusicObject_ParseDescriptor(&This->dmobj.IDirectMusicObject_iface, stream,
             &This->dmobj.desc);
     if (FAILED(hr))
-- 
2.14.4




More information about the wine-devel mailing list