Signed-off-by: Eric Pouech eric.pouech@gmail.com
Supersedes 230982
--- dlls/mciwave/mciwave.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/mciwave/mciwave.c b/dlls/mciwave/mciwave.c index 1d9abce84a3..3ca884ed6e0 100644 --- a/dlls/mciwave/mciwave.c +++ b/dlls/mciwave/mciwave.c @@ -291,7 +291,7 @@ static DWORD WAVE_mciReadFmt(WINE_MCIWAVE* wmw, const MMCKINFO* pckMainRIFF) if (!pwfx) return MCIERR_OUT_OF_MEMORY;
r = mmioRead(wmw->hFile, (HPSTR)pwfx, mmckInfo.cksize); - if (r < sizeof(PCMWAVEFORMAT)) { + if (r < 0 || r < sizeof(PCMWAVEFORMAT)) { HeapFree(GetProcessHeap(), 0, pwfx); return MCIERR_INVALID_FILE; }
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
--- dlls/winmm/mmio.c | 4 ++-- dlls/winmm/playsound.c | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/dlls/winmm/mmio.c b/dlls/winmm/mmio.c index 352da62a215..d61b3c90c49 100644 --- a/dlls/winmm/mmio.c +++ b/dlls/winmm/mmio.c @@ -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; diff --git a/dlls/winmm/playsound.c b/dlls/winmm/playsound.c index 0858f958583..d844bf9b0ab 100644 --- a/dlls/winmm/playsound.c +++ b/dlls/winmm/playsound.c @@ -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);
Signed-off-by: Andrew Eikum aeikum@codeweavers.com
On Wed, Mar 30, 2022 at 02:57:44PM +0200, Eric Pouech wrote:
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
dlls/winmm/mmio.c | 4 ++-- dlls/winmm/playsound.c | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/dlls/winmm/mmio.c b/dlls/winmm/mmio.c index 352da62a215..d61b3c90c49 100644 --- a/dlls/winmm/mmio.c +++ b/dlls/winmm/mmio.c @@ -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;
diff --git a/dlls/winmm/playsound.c b/dlls/winmm/playsound.c index 0858f958583..d844bf9b0ab 100644 --- a/dlls/winmm/playsound.c +++ b/dlls/winmm/playsound.c @@ -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);
Signed-off-by: Andrew Eikum aeikum@codeweavers.com
On Wed, Mar 30, 2022 at 02:57:38PM +0200, Eric Pouech wrote:
Signed-off-by: Eric Pouech eric.pouech@gmail.com
Supersedes 230982
dlls/mciwave/mciwave.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/dlls/mciwave/mciwave.c b/dlls/mciwave/mciwave.c index 1d9abce84a3..3ca884ed6e0 100644 --- a/dlls/mciwave/mciwave.c +++ b/dlls/mciwave/mciwave.c @@ -291,7 +291,7 @@ static DWORD WAVE_mciReadFmt(WINE_MCIWAVE* wmw, const MMCKINFO* pckMainRIFF) if (!pwfx) return MCIERR_OUT_OF_MEMORY;
r = mmioRead(wmw->hFile, (HPSTR)pwfx, mmckInfo.cksize);
- if (r < sizeof(PCMWAVEFORMAT)) {
- if (r < 0 || r < sizeof(PCMWAVEFORMAT)) { HeapFree(GetProcessHeap(), 0, pwfx); return MCIERR_INVALID_FILE; }