[WINMM] Fix segfault.
Sean Young
sean at mess.org
Wed Feb 25 15:06:14 CST 2004
Warcraft II was segfaulting in winmm (waveOutUnprepareHeader). While I was
at it, I've also experimented with the uSize parameter on WinXP; verified
for waveOutUnprepareHeader and waveOutPrepareHeader (sorry, don't have any
others than WinXP available here).
Sean
Index: dlls/winmm/winmm.c
===================================================================
RCS file: /home/wine/wine/dlls/winmm/winmm.c,v
retrieving revision 1.31
diff -u -r1.31 winmm.c
--- dlls/winmm/winmm.c 24 Feb 2004 01:02:01 -0000 1.31
+++ dlls/winmm/winmm.c 25 Feb 2004 20:51:53 -0000
@@ -2607,7 +2607,8 @@
TRACE("(%p, %p, %u);\n", hWaveOut, lpWaveOutHdr, uSize);
- if (lpWaveOutHdr == NULL) return MMSYSERR_INVALPARAM;
+ if (lpWaveOutHdr == NULL || uSize < sizeof (WAVEHDR))
+ return MMSYSERR_INVALPARAM;
if ((wmld = MMDRV_Get(hWaveOut, MMDRV_WAVEOUT, FALSE)) == NULL)
return MMSYSERR_INVALHANDLE;
@@ -2625,6 +2626,9 @@
TRACE("(%p, %p, %u);\n", hWaveOut, lpWaveOutHdr, uSize);
+ if (lpWaveOutHdr == NULL || uSize < sizeof (WAVEHDR))
+ return MMSYSERR_INVALPARAM;
+
if (!(lpWaveOutHdr->dwFlags & WHDR_PREPARED)) {
return MMSYSERR_NOERROR;
}
More information about the wine-patches
mailing list