[PATCH] winealsa: fix input sound distortion and heap corruption

Mark Harmstone hellas at burntcomma.com
Thu Nov 6 22:06:55 CST 2014


At present, winealsa attempts to call map_channels when a capture device 
is opened. If a microphone can be opened in either stereo or mono mode, 
and mono is requested, Wine will still return stereo data. Not only does 
this result in distorted in audio, it also very frequently results in 
heap corruption when snd_pcm_readi overruns the buffer allocated by the 
program.

I don't have a copy of World of Warcraft to test this on, but this may 
also fix bug 31684. It's the same symptoms, at least.

---
  dlls/winealsa.drv/mmdevdrv.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/winealsa.drv/mmdevdrv.c b/dlls/winealsa.drv/mmdevdrv.c
index a4c02bf..91fba2f 100644
--- a/dlls/winealsa.drv/mmdevdrv.c
+++ b/dlls/winealsa.drv/mmdevdrv.c
@@ -1164,7 +1164,7 @@ static DWORD get_channel_mask(unsigned int channels)

  static HRESULT map_channels(ACImpl *This, const WAVEFORMATEX *fmt)
  {
-    if(fmt->wFormatTag == WAVE_FORMAT_EXTENSIBLE || fmt->nChannels > 2){
+    if( (This->dataflow != eCapture && fmt->wFormatTag == 
WAVE_FORMAT_EXTENSIBLE) || fmt->nChannels > 2){
          WAVEFORMATEXTENSIBLE *fmtex = (void*)fmt;
          DWORD mask, flag = SPEAKER_FRONT_LEFT;
          UINT i = 0;
-- 
2.0.4



More information about the wine-patches mailing list