PulseAudio: Fix a crash if the requested channel count is too high.

This commit is contained in:
David Reid
2025-07-04 06:37:08 +10:00
parent 2bc0e14abf
commit 1c7967fc88
+10
View File
@@ -31890,6 +31890,11 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi
ss.channels = pDescriptorCapture->channels;
}
/* PulseAudio has a maximum channel count of 32. We'll get a crash if this is exceeded. */
if (ss.channels > 32) {
ss.channels = 32;
}
/* Use a default channel map. */
((ma_pa_channel_map_init_extend_proc)pDevice->pContext->pulse.pa_channel_map_init_extend)(&cmap, ss.channels, pConfig->pulse.channelMap);
@@ -32042,6 +32047,11 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi
ss.channels = pDescriptorPlayback->channels;
}
/* PulseAudio has a maximum channel count of 32. We'll get a crash if this is exceeded. */
if (ss.channels > 32) {
ss.channels = 32;
}
/* Use a default channel map. */
((ma_pa_channel_map_init_extend_proc)pDevice->pContext->pulse.pa_channel_map_init_extend)(&cmap, ss.channels, pConfig->pulse.channelMap);