mirror of
https://github.com/reactos/reactos.git
synced 2024-09-29 14:09:10 +00:00
[WINESYNC][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 Wine commit: 0de8d01b09b1cc7ca34f7ae3890b4a416ff801fe author: Eric Pouech <eric.pouech@gmail.com> Wed, 30 Mar 2022 12:57:44 +0000 (14:57 +0200) committer: Alexandre Julliard <julliard@winehq.org> Fri, 1 Apr 2022 20:59:40 +0000 (22:59 +0200)
This commit is contained in:
parent
e85c54a5c7
commit
b30a8a0868
|
@ -1161,7 +1161,7 @@ MMRESULT WINAPI mmioDescend(HMMIO hmmio, LPMMCKINFO lpck,
|
||||||
LONG ix;
|
LONG ix;
|
||||||
|
|
||||||
ix = mmioRead(hmmio, (LPSTR)lpck, 3 * sizeof(DWORD));
|
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);
|
mmioSeek(hmmio, dwOldPos, SEEK_SET);
|
||||||
WARN("return ChunkNotFound\n");
|
WARN("return ChunkNotFound\n");
|
||||||
|
@ -1263,7 +1263,7 @@ MMRESULT WINAPI mmioCreateChunk(HMMIO hmmio, MMCKINFO* lpck, UINT uFlags)
|
||||||
|
|
||||||
ix = mmioWrite(hmmio, (LPSTR)lpck, size);
|
ix = mmioWrite(hmmio, (LPSTR)lpck, size);
|
||||||
TRACE("after mmioWrite ix = %d req = %d, errno = %d\n", ix, size, errno);
|
TRACE("after mmioWrite ix = %d req = %d, errno = %d\n", ix, size, errno);
|
||||||
if (ix < size) {
|
if (ix != size) {
|
||||||
mmioSeek(hmmio, dwOldPos, SEEK_SET);
|
mmioSeek(hmmio, dwOldPos, SEEK_SET);
|
||||||
WARN("return CannotWrite\n");
|
WARN("return CannotWrite\n");
|
||||||
return MMIOERR_CANNOTWRITE;
|
return MMIOERR_CANNOTWRITE;
|
||||||
|
|
|
@ -428,6 +428,7 @@ static BOOL proc_PlaySound(WINE_PLAYSOUND *wps)
|
||||||
LPWAVEHDR waveHdr = NULL;
|
LPWAVEHDR waveHdr = NULL;
|
||||||
INT count, bufsize, left, index;
|
INT count, bufsize, left, index;
|
||||||
struct playsound_data s;
|
struct playsound_data s;
|
||||||
|
LONG r;
|
||||||
|
|
||||||
s.hEvent = 0;
|
s.hEvent = 0;
|
||||||
|
|
||||||
|
@ -451,8 +452,9 @@ static BOOL proc_PlaySound(WINE_PLAYSOUND *wps)
|
||||||
lpWaveFormat = HeapAlloc(GetProcessHeap(), 0, mmckInfo.cksize);
|
lpWaveFormat = HeapAlloc(GetProcessHeap(), 0, mmckInfo.cksize);
|
||||||
if (!lpWaveFormat)
|
if (!lpWaveFormat)
|
||||||
goto errCleanUp;
|
goto errCleanUp;
|
||||||
if (mmioRead(wps->hmmio, (HPSTR)lpWaveFormat, mmckInfo.cksize) < sizeof(PCMWAVEFORMAT))
|
r = mmioRead(wps->hmmio, (HPSTR)lpWaveFormat, mmckInfo.cksize);
|
||||||
goto errCleanUp;
|
if (r < 0 || r < sizeof(PCMWAVEFORMAT))
|
||||||
|
goto errCleanUp;
|
||||||
|
|
||||||
TRACE("wFormatTag=%04X !\n", lpWaveFormat->wFormatTag);
|
TRACE("wFormatTag=%04X !\n", lpWaveFormat->wFormatTag);
|
||||||
TRACE("nChannels=%d\n", lpWaveFormat->nChannels);
|
TRACE("nChannels=%d\n", lpWaveFormat->nChannels);
|
||||||
|
|
Loading…
Reference in a new issue