mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-29 05:40:23 -04:00
native: make sure clients cannot trigger an assert by sending us invalid volume info
This commit is contained in:
parent
8bf2e3fe94
commit
e1ce365cd9
1 changed files with 6 additions and 1 deletions
|
|
@ -3390,12 +3390,18 @@ static void command_set_volume(
|
|||
client_name = pa_strnull(pa_proplist_gets(c->client->proplist, PA_PROP_APPLICATION_PROCESS_BINARY));
|
||||
|
||||
if (sink) {
|
||||
CHECK_VALIDITY(c->pstream, pa_cvolume_compatible(&volume, &sink->sample_spec), tag, PA_ERR_INVALID);
|
||||
|
||||
pa_log_debug("Client %s changes volume of sink %s.", client_name, sink->name);
|
||||
pa_sink_set_volume(sink, &volume, TRUE, TRUE);
|
||||
} else if (source) {
|
||||
CHECK_VALIDITY(c->pstream, pa_cvolume_compatible(&volume, &source->sample_spec), tag, PA_ERR_INVALID);
|
||||
|
||||
pa_log_debug("Client %s changes volume of source %s.", client_name, source->name);
|
||||
pa_source_set_volume(source, &volume, TRUE);
|
||||
} else if (si) {
|
||||
CHECK_VALIDITY(c->pstream, pa_cvolume_compatible(&volume, &si->sample_spec), tag, PA_ERR_INVALID);
|
||||
|
||||
pa_log_debug("Client %s changes volume of sink input %s.",
|
||||
client_name,
|
||||
pa_strnull(pa_proplist_gets(si->proplist, PA_PROP_MEDIA_NAME)));
|
||||
|
|
@ -3441,7 +3447,6 @@ static void command_set_mute(
|
|||
switch (command) {
|
||||
|
||||
case PA_COMMAND_SET_SINK_MUTE:
|
||||
|
||||
if (idx != PA_INVALID_INDEX)
|
||||
sink = pa_idxset_get_by_index(c->protocol->core->sinks, idx);
|
||||
else
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue