*: more type checks for POD

Check that POD is correctly typed before using it.
This commit is contained in:
Demi Marie Obenour 2025-07-24 19:33:38 -04:00
parent a50b66651e
commit c64a34d93f
20 changed files with 67 additions and 28 deletions

View file

@ -1657,6 +1657,9 @@ static int apply_props(struct impl *this, const struct spa_pod *param)
spa_zero(vrp);
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_volume:
@ -1827,7 +1830,9 @@ static int apply_midi(struct impl *this, const struct spa_pod *value)
uint8_t data[8];
int size;
size = spa_ump_to_midi(SPA_POD_BODY(value), SPA_POD_BODY_SIZE(value),
if (!spa_pod_is_bytes(value))
return -EINVAL;
size = spa_ump_to_midi(SPA_POD_BODY(value), value->size,
data, sizeof(data));
if (size < 3)
return -EINVAL;
@ -1973,7 +1978,8 @@ static int node_set_param_props(struct impl *this, uint32_t flags,
if (param == NULL)
return 0;
if (!spa_pod_is_object_type(param, SPA_TYPE_OBJECT_Props))
return -EINVAL;
this->filter_props_count = 0;
spa_list_for_each_safe(g, t, &this->active_graphs, link) {