summaryrefslogtreecommitdiff
path: root/spa
diff options
context:
space:
mode:
authorWim Taymans <wtaymans@redhat.com>2017-12-01 10:13:53 +0100
committerWim Taymans <wtaymans@redhat.com>2017-12-01 10:13:53 +0100
commit3a9070ee10a2bab5e5be87993c2f4f7727ab0f5b (patch)
treead36f6c6cdf2408ebf352993f2ad3a6d5544436a /spa
parentd2516398eddee663a156b44f1a3d89a9c6518b2a (diff)
don't check contents of control values
The control values do not have to contain valid values when they are set so don't try to parse them. Instead just do a simple sanity check on the size. Handle the case where we clear the io area, go back to the default node properties.
Diffstat (limited to 'spa')
-rw-r--r--spa/plugins/audiomixer/audiomixer.c10
-rw-r--r--spa/plugins/audiotestsrc/audiotestsrc.c12
2 files changed, 14 insertions, 8 deletions
diff --git a/spa/plugins/audiomixer/audiomixer.c b/spa/plugins/audiomixer/audiomixer.c
index 7e5f9ee9..1d128086 100644
--- a/spa/plugins/audiomixer/audiomixer.c
+++ b/spa/plugins/audiomixer/audiomixer.c
@@ -753,9 +753,15 @@ impl_node_port_set_io(struct spa_node *node,
else if (id == t->io.ControlRange)
port->io_range = data;
else if (id == t->io_prop_volume && direction == SPA_DIRECTION_INPUT)
- port->io_volume = &SPA_POD_VALUE(struct spa_pod_double, data);
+ if (data && size >= sizeof(struct spa_pod_double))
+ port->io_volume = &SPA_POD_VALUE(struct spa_pod_double, data);
+ else
+ port->io_volume = &port->props.volume;
else if (id == t->io_prop_mute && direction == SPA_DIRECTION_INPUT)
- port->io_mute = &SPA_POD_VALUE(struct spa_pod_bool, data);
+ if (data && size >= sizeof(struct spa_pod_bool))
+ port->io_mute = &SPA_POD_VALUE(struct spa_pod_bool, data);
+ else
+ port->io_mute = &port->props.mute;
else
return -ENOENT;
diff --git a/spa/plugins/audiotestsrc/audiotestsrc.c b/spa/plugins/audiotestsrc/audiotestsrc.c
index 3b3b4ccd..1016d854 100644
--- a/spa/plugins/audiotestsrc/audiotestsrc.c
+++ b/spa/plugins/audiotestsrc/audiotestsrc.c
@@ -905,21 +905,21 @@ impl_node_port_set_io(struct spa_node *node,
else if (id == t->io.ControlRange)
this->io_range = data;
else if (id == t->io_prop_wave) {
- if (SPA_POD_TYPE(data) == SPA_POD_TYPE_ID)
+ if (data && size >= sizeof(struct spa_pod_id))
this->io_wave = &SPA_POD_VALUE(struct spa_pod_id, data);
else
- return -EINVAL;
+ this->io_wave = &this->props.wave;
}
else if (id == t->io_prop_freq)
- if (SPA_POD_TYPE(data) == SPA_POD_TYPE_DOUBLE)
+ if (data && size >= sizeof(struct spa_pod_double))
this->io_freq = &SPA_POD_VALUE(struct spa_pod_double, data);
else
- return -EINVAL;
+ this->io_freq = &this->props.freq;
else if (id == t->io_prop_volume)
- if (SPA_POD_TYPE(data) == SPA_POD_TYPE_DOUBLE)
+ if (data && size >= sizeof(struct spa_pod_double))
this->io_volume = &SPA_POD_VALUE(struct spa_pod_double, data);
else
- return -EINVAL;
+ this->io_volume = &this->props.volume;
else
return -ENOENT;