mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-06 13:30:01 -05:00
src: check that POD arrays have the correct size for their type
The parser does not check that POD arrays have the correct size for their type, so the calling code must do that. This also enumerates some of the code that cannot handle the size of the values of an array not being the exact expected size for its type. There is a lot of it.
This commit is contained in:
parent
0f6b365138
commit
9e789c65c2
4 changed files with 32 additions and 21 deletions
|
|
@ -1284,7 +1284,7 @@ static int endpoint_link_proxy_demarshal_subscribe_params(void *object,
|
|||
SPA_POD_Array(&csize, &ctype, &n_ids, &ids)) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
if (ctype != SPA_TYPE_Id)
|
||||
if (ctype != SPA_TYPE_Id || csize != sizeof(uint32_t))
|
||||
return -EINVAL;
|
||||
|
||||
return pw_proxy_notify(proxy, struct pw_endpoint_link_methods,
|
||||
|
|
@ -1304,7 +1304,7 @@ static int endpoint_link_resource_demarshal_subscribe_params(void *object,
|
|||
SPA_POD_Array(&csize, &ctype, &n_ids, &ids)) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
if (ctype != SPA_TYPE_Id)
|
||||
if (ctype != SPA_TYPE_Id || csize != sizeof(uint32_t))
|
||||
return -EINVAL;
|
||||
|
||||
return pw_resource_notify(resource, struct pw_endpoint_link_methods,
|
||||
|
|
@ -1806,7 +1806,7 @@ static int endpoint_stream_proxy_demarshal_subscribe_params(void *object,
|
|||
SPA_POD_Array(&csize, &ctype, &n_ids, &ids)) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
if (ctype != SPA_TYPE_Id)
|
||||
if (ctype != SPA_TYPE_Id || csize != sizeof(uint32_t))
|
||||
return -EINVAL;
|
||||
|
||||
return pw_proxy_notify(proxy, struct pw_endpoint_stream_methods,
|
||||
|
|
@ -1826,7 +1826,7 @@ static int endpoint_stream_resource_demarshal_subscribe_params(void *object,
|
|||
SPA_POD_Array(&csize, &ctype, &n_ids, &ids)) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
if (ctype != SPA_TYPE_Id)
|
||||
if (ctype != SPA_TYPE_Id || csize != sizeof(uint32_t))
|
||||
return -EINVAL;
|
||||
|
||||
return pw_resource_notify(resource, struct pw_endpoint_stream_methods,
|
||||
|
|
@ -2320,7 +2320,7 @@ static int endpoint_proxy_demarshal_subscribe_params(void *object,
|
|||
SPA_POD_Array(&csize, &ctype, &n_ids, &ids)) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
if (ctype != SPA_TYPE_Id)
|
||||
if (ctype != SPA_TYPE_Id || csize != sizeof(uint32_t))
|
||||
return -EINVAL;
|
||||
|
||||
return pw_proxy_notify(proxy, struct pw_endpoint_methods,
|
||||
|
|
@ -2340,7 +2340,7 @@ static int endpoint_resource_demarshal_subscribe_params(void *object,
|
|||
SPA_POD_Array(&csize, &ctype, &n_ids, &ids)) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
if (ctype != SPA_TYPE_Id)
|
||||
if (ctype != SPA_TYPE_Id || csize != sizeof(uint32_t))
|
||||
return -EINVAL;
|
||||
|
||||
return pw_resource_notify(resource, struct pw_endpoint_methods,
|
||||
|
|
@ -2842,7 +2842,7 @@ static int session_proxy_demarshal_subscribe_params(void *object,
|
|||
SPA_POD_Array(&csize, &ctype, &n_ids, &ids)) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
if (ctype != SPA_TYPE_Id)
|
||||
if (ctype != SPA_TYPE_Id || csize != sizeof(uint32_t))
|
||||
return -EINVAL;
|
||||
|
||||
return pw_proxy_notify(proxy, struct pw_session_methods,
|
||||
|
|
@ -2862,7 +2862,7 @@ static int session_resource_demarshal_subscribe_params(void *object,
|
|||
SPA_POD_Array(&csize, &ctype, &n_ids, &ids)) < 0)
|
||||
return -EINVAL;
|
||||
|
||||
if (ctype != SPA_TYPE_Id)
|
||||
if (ctype != SPA_TYPE_Id || csize != sizeof(uint32_t))
|
||||
return -EINVAL;
|
||||
|
||||
return pw_resource_notify(resource, struct pw_session_methods,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue