Module: wine Branch: master Commit: 2ba39c89018717af8efc7d12c68204b35be329fe URL: https://source.winehq.org/git/wine.git/?a=commit;h=2ba39c89018717af8efc7d12c...
Author: Michael Stefaniuc mstefani@winehq.org Date: Fri Dec 20 23:55:36 2019 +0100
dmstyle: Avoid cloning the IStream in parse_style_form().
It can be an application provided IStream with unimplemented Clone() method.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=31562 Signed-off-by: Michael Stefaniuc mstefani@winehq.org Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/dmstyle/style.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/dlls/dmstyle/style.c b/dlls/dmstyle/style.c index 5ebe6589d4..3e480028b9 100644 --- a/dlls/dmstyle/style.c +++ b/dlls/dmstyle/style.c @@ -778,23 +778,21 @@ static HRESULT parse_style_form(IDirectMusicStyle8Impl *This, DMUS_PRIVATE_CHUNK ListCount[0] = 0; switch (Chunk.fccID) { case DMUS_FOURCC_BAND_FORM: { - LPSTREAM pClonedStream = NULL; + ULARGE_INTEGER save; struct style_band *pNewBand;
TRACE_(dmfile)(": BAND RIFF\n"); - - IStream_Clone (pStm, &pClonedStream); - + + /* Can be application provided IStream without Clone method */ liMove.QuadPart = 0; liMove.QuadPart -= sizeof(FOURCC) + (sizeof(FOURCC)+sizeof(DWORD)); - IStream_Seek (pClonedStream, liMove, STREAM_SEEK_CUR, NULL); + IStream_Seek(pStm, liMove, STREAM_SEEK_CUR, &save);
- hr = load_band(pClonedStream, &pBand); + hr = load_band(pStm, &pBand); if (FAILED(hr)) { ERR(": could not load track\n"); return hr; } - IStream_Release (pClonedStream);
pNewBand = heap_alloc_zero(sizeof(*pNewBand)); if (NULL == pNewBand) { @@ -808,9 +806,9 @@ static HRESULT parse_style_form(IDirectMusicStyle8Impl *This, DMUS_PRIVATE_CHUNK IDirectMusicTrack_Release(pBand); pBand = NULL; /* now we can release it as it's inserted */ /** now safely move the cursor */ - liMove.QuadPart = ListSize[0]; - IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); - + liMove.QuadPart = save.QuadPart - liMove.QuadPart + ListSize[0]; + IStream_Seek(pStm, liMove, STREAM_SEEK_SET, NULL); + break; } default: {