diff --git a/src/gst/gstpipewireformat.c b/src/gst/gstpipewireformat.c index c4c613454..b16f7b1cf 100644 --- a/src/gst/gstpipewireformat.c +++ b/src/gst/gstpipewireformat.c @@ -729,7 +729,7 @@ handle_id_prop (const struct spa_pod_prop *prop, const char *key, id_to_string_f uint32_t i, n_items, choice; val = spa_pod_get_values(&prop->value, &n_items, &choice); - if (val->type != SPA_TYPE_Id) + if (val->type != SPA_TYPE_Id || n_items == 0) return; id = SPA_POD_BODY(val); @@ -770,7 +770,7 @@ handle_int_prop (const struct spa_pod_prop *prop, const char *key, GstCaps *res) uint32_t i, n_items, choice; val = spa_pod_get_values(&prop->value, &n_items, &choice); - if (val->type != SPA_TYPE_Int) + if (val->type != SPA_TYPE_Int || n_items == 0) return; ints = SPA_POD_BODY(val); @@ -814,7 +814,7 @@ handle_rect_prop (const struct spa_pod_prop *prop, const char *width, const char uint32_t i, n_items, choice; val = spa_pod_get_values(&prop->value, &n_items, &choice); - if (val->type != SPA_TYPE_Rectangle) + if (val->type != SPA_TYPE_Rectangle || n_items == 0) return; rect = SPA_POD_BODY(val); @@ -867,7 +867,7 @@ handle_fraction_prop (const struct spa_pod_prop *prop, const char *key, GstCaps uint32_t i, n_items, choice; val = spa_pod_get_values(&prop->value, &n_items, &choice); - if (val->type != SPA_TYPE_Fraction) + if (val->type != SPA_TYPE_Fraction || n_items == 0) return; fract = SPA_POD_BODY(val); diff --git a/src/modules/module-protocol-pulse/format.c b/src/modules/module-protocol-pulse/format.c index a73317f9d..8ab786b3f 100644 --- a/src/modules/module-protocol-pulse/format.c +++ b/src/modules/module-protocol-pulse/format.c @@ -687,6 +687,9 @@ static int add_int(struct format_info *info, const char *k, struct spa_pod *para if (val->type != SPA_TYPE_Int) return -ENOTSUP; + if (n_values == 0) + return -ENOENT; + values = SPA_POD_BODY(val); switch (choice) { diff --git a/src/pipewire/stream.c b/src/pipewire/stream.c index 4789569c8..8b64635e8 100644 --- a/src/pipewire/stream.c +++ b/src/pipewire/stream.c @@ -1271,6 +1271,10 @@ static int node_event_param(void *object, int seq, } pod = spa_pod_get_values(type, &n_vals, &choice); + if (n_vals == 0) { + free(c); + return -EINVAL; + } c->type = SPA_POD_TYPE(pod); if (spa_pod_is_float(pod))