winmm: Properly handle mmioRead/mmioWrite in case of errors.
In C, an inequality comparison between a signed and an unsigned integer ends up with an unsigned comparison. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=52628 Signed-off-by: Eric Pouech <eric.pouech@gmail.com> Signed-off-by: Andrew Eikum <aeikum@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
90ecf27d09
commit
0de8d01b09
|
@ -1234,7 +1234,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");
|
||||
|
@ -1336,7 +1336,7 @@ MMRESULT WINAPI mmioCreateChunk(HMMIO hmmio, MMCKINFO* lpck, UINT uFlags)
|
|||
|
||||
ix = mmioWrite(hmmio, (LPSTR)lpck, size);
|
||||
TRACE("after mmioWrite ix = %ld req = %ld, errno = %d\n", ix, size, errno);
|
||||
if (ix < size) {
|
||||
if (ix != size) {
|
||||
mmioSeek(hmmio, dwOldPos, SEEK_SET);
|
||||
WARN("return CannotWrite\n");
|
||||
return MMIOERR_CANNOTWRITE;
|
||||
|
|
|
@ -262,6 +262,7 @@ static DWORD WINAPI proc_PlaySound(LPVOID arg)
|
|||
INT count, bufsize, left, index;
|
||||
struct playsound_data s;
|
||||
void* data;
|
||||
LONG r;
|
||||
|
||||
s.hEvent = 0;
|
||||
|
||||
|
@ -361,7 +362,8 @@ static DWORD WINAPI proc_PlaySound(LPVOID arg)
|
|||
lpWaveFormat = HeapAlloc(GetProcessHeap(), 0, mmckInfo.cksize);
|
||||
if (!lpWaveFormat)
|
||||
goto errCleanUp;
|
||||
if (mmioRead(hmmio, (HPSTR)lpWaveFormat, mmckInfo.cksize) < sizeof(PCMWAVEFORMAT))
|
||||
r = mmioRead(hmmio, (HPSTR)lpWaveFormat, mmckInfo.cksize);
|
||||
if (r < 0 || r < sizeof(PCMWAVEFORMAT))
|
||||
goto errCleanUp;
|
||||
|
||||
TRACE("wFormatTag=%04X !\n", lpWaveFormat->wFormatTag);
|
||||
|
|
Loading…
Reference in New Issue