mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-05-04 06:46:24 -04:00
*: more type checks for POD
Check that POD is correctly typed before using it.
This commit is contained in:
parent
a50b66651e
commit
c64a34d93f
20 changed files with 67 additions and 28 deletions
|
|
@ -711,6 +711,8 @@ static int apply_props(struct impl *this, const struct spa_pod *param)
|
|||
struct spa_pod_object *obj = (struct spa_pod_object *) param;
|
||||
int changed = 0;
|
||||
|
||||
if (!spa_pod_is_object_type(param, SPA_TYPE_OBJECT_Props))
|
||||
return -EINVAL;
|
||||
SPA_POD_OBJECT_FOREACH(obj, prop) {
|
||||
switch (prop->key) {
|
||||
case SPA_PROP_params:
|
||||
|
|
@ -807,9 +809,6 @@ static int node_set_param_port_config(struct impl *this, uint32_t flags,
|
|||
bool monitor = false, control = false;
|
||||
int res;
|
||||
|
||||
if (param == NULL)
|
||||
return 0;
|
||||
|
||||
if (spa_pod_parse_object(param,
|
||||
SPA_TYPE_OBJECT_ParamPortConfig, NULL,
|
||||
SPA_PARAM_PORT_CONFIG_direction, SPA_POD_Id(&direction),
|
||||
|
|
@ -831,15 +830,6 @@ static int node_set_param_port_config(struct impl *this, uint32_t flags,
|
|||
return reconfigure_mode(this, mode, direction, monitor, control, infop);
|
||||
}
|
||||
|
||||
static int node_set_param_props(struct impl *this, uint32_t flags,
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
if (param == NULL)
|
||||
return 0;
|
||||
|
||||
apply_props(this, param);
|
||||
return 0;
|
||||
}
|
||||
static int impl_node_set_param(void *object, uint32_t id, uint32_t flags,
|
||||
const struct spa_pod *param)
|
||||
{
|
||||
|
|
@ -850,10 +840,10 @@ static int impl_node_set_param(void *object, uint32_t id, uint32_t flags,
|
|||
|
||||
switch (id) {
|
||||
case SPA_PARAM_PortConfig:
|
||||
res = node_set_param_port_config(this, flags, param);
|
||||
res = param ? node_set_param_port_config(this, flags, param) : 0;
|
||||
break;
|
||||
case SPA_PARAM_Props:
|
||||
res = node_set_param_props(this, flags, param);
|
||||
res = param ? apply_props(this, param) : 0;
|
||||
break;
|
||||
default:
|
||||
return -ENOENT;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue