On Tue, Aug 20, 2013 at 05:57:34AM +0200, Fabrice Bauzac wrote:
Hello,
This patch intends to fix the bug: http://bugs.winehq.org/show_bug.cgi?id=34305
The bug: basically, when there is no sound device and the user tries to WOD_Open() the WAVE_MAPPER pseudodevice, the code calls read_map() with device index 0 without first checking whether the number of devices is greater than 0.
Looks good to me, thanks. I tested on Windows 7, and the error code is correct.
By the way, the waveIn path (WID_Open) has the same bug. Feel free to fix that, too, if you want. Or I'll submit a patch myself later.
Andrew
Hello,
Indeed, WID_Open certainly suffers from the same problem.
Here is the patch for both.
From 51cee06af9f5901ca7310aad1077d4b07472da1e Mon Sep 17 00:00:00 2001
From: Fabrice Bauzac libnoon@gmail.com Date: Tue, 20 Aug 2013 05:37:53 +0200 Subject: winmm: fix WOD_Open() and WID_Open() WAVE_MAPPER no-device case.
WOD_Open() and WID_Open() now return MMSYSERR_BADDEVICEID in case WAVE_MAPPER is requested and no device is present.
Fixes #34305. --- dlls/winmm/waveform.c | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/dlls/winmm/waveform.c b/dlls/winmm/waveform.c index 752e64d..bb91a22 100644 --- a/dlls/winmm/waveform.c +++ b/dlls/winmm/waveform.c @@ -1228,6 +1228,9 @@ static LRESULT WOD_Open(WINMM_OpenInfo *info) WINMM_MMDevice *mmdevice;
if(WINMM_IsMapper(info->req_device)){ + if (g_outmmdevices_count == 0) { + return MMSYSERR_BADDEVICEID; + } devices = g_out_mapper_devices; mmdevice = read_map(g_out_map, 0); lock = &g_devthread_lock; @@ -1317,6 +1320,9 @@ static LRESULT WID_Open(WINMM_OpenInfo *info) HRESULT hr;
if(WINMM_IsMapper(info->req_device)){ + if (g_inmmdevices_count == 0) { + return MMSYSERR_BADDEVICEID; + } devices = g_in_mapper_devices; mmdevice = read_map(g_in_map, 0); lock = &g_devthread_lock;
On Tue, Aug 20, 2013 at 07:06:13PM +0200, Fabrice Bauzac wrote:
if (g_inmmdevices_count == 0) {
- return MMSYSERR_BADDEVICEID;
}
Looks like the indentation is bad here.
Also please submit the patch to wine-patches. Patches aren't picked up from wine-devel.
Thanks for the fix!
Andrew