[PATCH 0/1] MR3575: winepulse: Fix crash when requesting exclusive mode with an unsupported format.
Fixes #55362. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/3575
From: Davide Beatrici <git(a)davidebeatrici.dev> --- dlls/winepulse.drv/pulse.c | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/dlls/winepulse.drv/pulse.c b/dlls/winepulse.drv/pulse.c index 0e587033a6d..10730cf4a4d 100644 --- a/dlls/winepulse.drv/pulse.c +++ b/dlls/winepulse.drv/pulse.c @@ -2221,9 +2221,18 @@ static NTSTATUS pulse_is_format_supported(void *args) break; } - /* This driver does not support exclusive mode. */ - if (exclusive && params->result == S_OK) - params->result = params->flow == eCapture ? AUDCLNT_E_UNSUPPORTED_FORMAT : AUDCLNT_E_EXCLUSIVE_MODE_NOT_ALLOWED; + if (exclusive) { + switch (params->result) { + case S_OK: + /* This driver does not support exclusive mode. */ + if (params->flow == eRender) { + params->result = AUDCLNT_E_EXCLUSIVE_MODE_NOT_ALLOWED; + break; + } + case S_FALSE: + params->result = AUDCLNT_E_UNSUPPORTED_FORMAT; + } + } return STATUS_SUCCESS; } -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/3575
Could you please add the `Wine-Bug:` tag to the commit message? -- https://gitlab.winehq.org/wine/wine/-/merge_requests/3575#note_42403
Huw Davies (@huw) commented about dlls/winepulse.drv/pulse.c:
break; }
- /* This driver does not support exclusive mode. */ - if (exclusive && params->result == S_OK) - params->result = params->flow == eCapture ? AUDCLNT_E_UNSUPPORTED_FORMAT : AUDCLNT_E_EXCLUSIVE_MODE_NOT_ALLOWED; + if (exclusive) { + switch (params->result) { + case S_OK: + /* This driver does not support exclusive mode. */ + if (params->flow == eRender) { + params->result = AUDCLNT_E_EXCLUSIVE_MODE_NOT_ALLOWED; + break; + } + case S_FALSE:
This fall-through is not very pleasant; please do this in a different way. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/3575#note_42405
participants (3)
-
Davide Beatrici -
Davide Beatrici (@davidebeatrici) -
Huw Davies (@huw)