spa: add some more POD tests

Check if the pod size is at least big enough to hold 1 item when getting
array or choice items.

Check that the number of choice values is at least enough to handle the
given choice type. Remove some redundant checks.
This commit is contained in:
Wim Taymans 2025-10-31 11:39:41 +01:00
parent 77a5100280
commit 95fb03c8e3
4 changed files with 30 additions and 9 deletions

View file

@ -164,8 +164,7 @@ SPA_API_DEBUG_FORMAT int spa_debugc_format(struct spa_debug_context *ctx, int in
type = val->type;
size = val->size;
if (type < SPA_TYPE_None || type >= _SPA_TYPE_LAST || n_vals < 1 ||
size < spa_pod_type_size(type))
if (type < SPA_TYPE_None || type >= _SPA_TYPE_LAST || n_vals < 1)
continue;
vals = SPA_POD_BODY(val);