Commit 1c7967fc authored by David Reid's avatar David Reid

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

parent 2bc0e14a
...@@ -31890,6 +31890,11 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi ...@@ -31890,6 +31890,11 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi
ss.channels = pDescriptorCapture->channels; 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. */ /* 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); ((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 ...@@ -32042,6 +32047,11 @@ static ma_result ma_device_init__pulse(ma_device* pDevice, const ma_device_confi
ss.channels = pDescriptorPlayback->channels; 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. */ /* 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); ((ma_pa_channel_map_init_extend_proc)pDevice->pContext->pulse.pa_channel_map_init_extend)(&cmap, ss.channels, pConfig->pulse.channelMap);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment