http://bugs.winehq.org/show_bug.cgi?id=16834
Summary: SetFormat() doesn't remap unmapped sound buffers on failure Product: Wine Version: 1.1.10 Platform: PC OS/Version: Linux Status: UNCONFIRMED Severity: major Priority: P2 Component: directx-dsound AssignedTo: wine-bugs@winehq.org ReportedBy: next_ghost@quick.cz
Railroad Tycoon 2 Platinum segfaults on startup because SetFormat() function in dlls/winealsa.drv/dsoutput.c does the following on my system:
- snd_pcm_open() - failure because already open (line 395) - snd_pcm_drop() (line 403) - snd_pcm_close() - existing sound buffer is now unmapped (line 404) - snd_pcm_open() - success (line 406) - snd_pcm_hw_params_set_channels(1) - failure because device has minimum of 2 channels (line 416) - goto err; (line 417) - return DSERR_BADFORMAT; (line 479)
The call to DSDB_CreateMMAP() on line 464 is skipped by goto err; so the already unmapped sound buffer is left in This. When DSOUND_PerformMix() tries to ZeroMemory this buffer, Wine segfaults.