mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
alsa: Fix crash when loading bare ALSA sink/source
module-alsa-{sink,source}.c call pa_alsa_{sink,source}_new with
mapping set to NULL. Guard against this, like the rest of the
function does.
module-alsa-card does not use NULL, so this went unnoticed so far.
This commit is contained in:
parent
35fea579cb
commit
f81e3e1d78
2 changed files with 20 additions and 16 deletions
|
|
@ -2032,14 +2032,16 @@ pa_sink *pa_alsa_sink_new(pa_module *m, pa_modargs *ma, const char*driver, pa_ca
|
||||||
map = m->core->default_channel_map;
|
map = m->core->default_channel_map;
|
||||||
|
|
||||||
/* Pick sample spec overrides from the mapping, if any */
|
/* Pick sample spec overrides from the mapping, if any */
|
||||||
if (mapping->sample_spec.format != PA_SAMPLE_INVALID)
|
if (mapping) {
|
||||||
ss.format = mapping->sample_spec.format;
|
if (mapping->sample_spec.format != PA_SAMPLE_INVALID)
|
||||||
if (mapping->sample_spec.rate != 0)
|
ss.format = mapping->sample_spec.format;
|
||||||
ss.rate = mapping->sample_spec.rate;
|
if (mapping->sample_spec.rate != 0)
|
||||||
if (mapping->sample_spec.channels != 0) {
|
ss.rate = mapping->sample_spec.rate;
|
||||||
ss.channels = mapping->sample_spec.channels;
|
if (mapping->sample_spec.channels != 0) {
|
||||||
if (pa_channel_map_valid(&mapping->channel_map))
|
ss.channels = mapping->sample_spec.channels;
|
||||||
pa_assert(pa_channel_map_compatible(&mapping->channel_map, &ss));
|
if (pa_channel_map_valid(&mapping->channel_map))
|
||||||
|
pa_assert(pa_channel_map_compatible(&mapping->channel_map, &ss));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Override with modargs if provided */
|
/* Override with modargs if provided */
|
||||||
|
|
|
||||||
|
|
@ -1742,14 +1742,16 @@ pa_source *pa_alsa_source_new(pa_module *m, pa_modargs *ma, const char*driver, p
|
||||||
map = m->core->default_channel_map;
|
map = m->core->default_channel_map;
|
||||||
|
|
||||||
/* Pick sample spec overrides from the mapping, if any */
|
/* Pick sample spec overrides from the mapping, if any */
|
||||||
if (mapping->sample_spec.format != PA_SAMPLE_INVALID)
|
if (mapping) {
|
||||||
ss.format = mapping->sample_spec.format;
|
if (mapping->sample_spec.format != PA_SAMPLE_INVALID)
|
||||||
if (mapping->sample_spec.rate != 0)
|
ss.format = mapping->sample_spec.format;
|
||||||
ss.rate = mapping->sample_spec.rate;
|
if (mapping->sample_spec.rate != 0)
|
||||||
if (mapping->sample_spec.channels != 0) {
|
ss.rate = mapping->sample_spec.rate;
|
||||||
ss.channels = mapping->sample_spec.channels;
|
if (mapping->sample_spec.channels != 0) {
|
||||||
if (pa_channel_map_valid(&mapping->channel_map))
|
ss.channels = mapping->sample_spec.channels;
|
||||||
pa_assert(pa_channel_map_compatible(&mapping->channel_map, &ss));
|
if (pa_channel_map_valid(&mapping->channel_map))
|
||||||
|
pa_assert(pa_channel_map_compatible(&mapping->channel_map, &ss));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Override with modargs if provided */
|
/* Override with modargs if provided */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue