*: mark code that cannot support oversized POD values

This should be supported, but lots of code doesn't support it yet.
This commit is contained in:
Demi Marie Obenour 2025-07-25 17:18:48 -04:00
parent fcfe01a0be
commit babcf6d118
5 changed files with 10 additions and 6 deletions

View file

@ -2256,7 +2256,7 @@ static int vidioc_queryctrl(struct file *file, struct v4l2_queryctrl *arg)
// check type and populate range // check type and populate range
pod = spa_pod_get_values(type, &n_vals, &choice); pod = spa_pod_get_values(type, &n_vals, &choice);
if (pod->type == SPA_TYPE_Int) { if (pod->type == SPA_TYPE_Int) {
if (n_vals < 4) if (pod->size != sizeof(int) || n_vals < 4)
break; break;
arg->type = V4L2_CTRL_TYPE_INTEGER; arg->type = V4L2_CTRL_TYPE_INTEGER;
int *v = SPA_POD_BODY(pod); int *v = SPA_POD_BODY(pod);

View file

@ -399,7 +399,7 @@ enum_filter_format(uint32_t media_type, int32_t media_subtype,
if (index == 0) if (index == 0)
video_format = values[0]; video_format = values[0];
} else { } else {
if (index < n_values - 1) if (index < n_values - 1 && val->size == sizeof(values[0]))
video_format = values[index + 1]; video_format = values[index + 1];
} }
} else { } else {

View file

@ -1117,7 +1117,7 @@ handle_int_prop (const struct spa_pod_prop *prop, const char *key, GstCaps *res)
case SPA_CHOICE_Range: case SPA_CHOICE_Range:
case SPA_CHOICE_Step: case SPA_CHOICE_Step:
{ {
if (n_items < 3) if (n_items < 3 || val->size != sizeof(ints[0]))
return; return;
gst_caps_set_simple (res, key, GST_TYPE_INT_RANGE, ints[1], ints[2], NULL); gst_caps_set_simple (res, key, GST_TYPE_INT_RANGE, ints[1], ints[2], NULL);
break; break;
@ -1225,7 +1225,7 @@ handle_fraction_prop (const struct spa_pod_prop *prop, const char *key, GstCaps
case SPA_CHOICE_Range: case SPA_CHOICE_Range:
case SPA_CHOICE_Step: case SPA_CHOICE_Step:
{ {
if (n_items < 3) if (n_items < 3 || val->size != sizeof(fract[0]))
return; return;
if (fract[1].num == fract[2].num && if (fract[1].num == fract[2].num &&

View file

@ -683,7 +683,7 @@ static int add_int(struct format_info *info, const char *k, struct spa_pod *para
return -ENOENT; return -ENOENT;
val = spa_pod_get_values(&prop->value, &n_values, &choice); val = spa_pod_get_values(&prop->value, &n_values, &choice);
if (val->type != SPA_TYPE_Int) if (val->type != SPA_TYPE_Int || val->size != sizeof(values[0]))
return -ENOTSUP; return -ENOTSUP;
if (n_values == 0) if (n_values == 0)
@ -745,7 +745,7 @@ static int format_info_iec958_from_param(struct format_info *info, struct spa_po
return -ENOENT; return -ENOENT;
val = spa_pod_get_values(&prop->value, &n_values, &choice); val = spa_pod_get_values(&prop->value, &n_values, &choice);
if (val->type != SPA_TYPE_Id) if (val->type != SPA_TYPE_Id || val->size != sizeof(values[0]))
return -ENOTSUP; return -ENOTSUP;
if (index >= n_values) if (index >= n_values)

View file

@ -1276,6 +1276,10 @@ static int node_event_param(void *object, int seq,
free(c); free(c);
return -EINVAL; return -EINVAL;
} }
if (n_vals > 1 && pod->size != spa_pod_type_size(pod->type)) {
free(c);
return -ENOTSUP;
}
c->type = pod->type; c->type = pod->type;
if (spa_pod_is_float(pod)) if (spa_pod_is_float(pod))