diff --git a/dll/win32/winmm/mmio.c b/dll/win32/winmm/mmio.c index 5e86722e747..9182d3b800c 100644 --- a/dll/win32/winmm/mmio.c +++ b/dll/win32/winmm/mmio.c @@ -1161,7 +1161,7 @@ MMRESULT WINAPI mmioDescend(HMMIO hmmio, LPMMCKINFO lpck, LONG ix; ix = mmioRead(hmmio, (LPSTR)lpck, 3 * sizeof(DWORD)); - if (ix < 2*sizeof(DWORD)) + if (ix < 0 || ix < 2*sizeof(DWORD)) { mmioSeek(hmmio, dwOldPos, SEEK_SET); WARN("return ChunkNotFound\n"); @@ -1263,7 +1263,7 @@ MMRESULT WINAPI mmioCreateChunk(HMMIO hmmio, MMCKINFO* lpck, UINT uFlags) ix = mmioWrite(hmmio, (LPSTR)lpck, size); TRACE("after mmioWrite ix = %d req = %d, errno = %d\n", ix, size, errno); - if (ix < size) { + if (ix != size) { mmioSeek(hmmio, dwOldPos, SEEK_SET); WARN("return CannotWrite\n"); return MMIOERR_CANNOTWRITE; diff --git a/dll/win32/winmm/playsound.c b/dll/win32/winmm/playsound.c index f71cbd32a21..b599073a2db 100644 --- a/dll/win32/winmm/playsound.c +++ b/dll/win32/winmm/playsound.c @@ -428,6 +428,7 @@ static BOOL proc_PlaySound(WINE_PLAYSOUND *wps) LPWAVEHDR waveHdr = NULL; INT count, bufsize, left, index; struct playsound_data s; + LONG r; s.hEvent = 0; @@ -451,8 +452,9 @@ static BOOL proc_PlaySound(WINE_PLAYSOUND *wps) lpWaveFormat = HeapAlloc(GetProcessHeap(), 0, mmckInfo.cksize); if (!lpWaveFormat) goto errCleanUp; - if (mmioRead(wps->hmmio, (HPSTR)lpWaveFormat, mmckInfo.cksize) < sizeof(PCMWAVEFORMAT)) - goto errCleanUp; + r = mmioRead(wps->hmmio, (HPSTR)lpWaveFormat, mmckInfo.cksize); + if (r < 0 || r < sizeof(PCMWAVEFORMAT)) + goto errCleanUp; TRACE("wFormatTag=%04X !\n", lpWaveFormat->wFormatTag); TRACE("nChannels=%d\n", lpWaveFormat->nChannels);