mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-03-31 07:11:14 -04:00
spa: Do not perform upper range check on 32-bit platforms
This commit is contained in:
parent
18c97222c4
commit
9ba92bd728
1 changed files with 8 additions and 1 deletions
|
|
@ -111,8 +111,15 @@ SPA_API_POD_BODY int spa_pod_choice_n_values(uint32_t choice_type, uint32_t *min
|
|||
SPA_API_POD_BODY int spa_pod_body_from_data(void *data, size_t maxsize, off_t offset, size_t size,
|
||||
struct spa_pod *pod, const void **body)
|
||||
{
|
||||
if (offset < 0 || offset > (int64_t)UINT32_MAX)
|
||||
if (offset < 0)
|
||||
return -EINVAL;
|
||||
/* On 32-bit platforms, off_t is a signed 32-bit type (since it tracks pointer
|
||||
* width), and consequently can never exceed UINT32_MAX. Skip the upper-bound
|
||||
* check on 32-bit platforms to avoid a compiler warning. */
|
||||
#if __SIZEOF_POINTER__ > 4
|
||||
if (offset > (int64_t)UINT32_MAX)
|
||||
return -EINVAL;
|
||||
#endif
|
||||
if (size < sizeof(struct spa_pod) ||
|
||||
size > maxsize ||
|
||||
maxsize - size < (uint32_t)offset)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue