mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-05-04 06:46:24 -04:00
Merge branch 'pod-parser-padding-zeroed' into 'master'
pod: check that padding is zeroed See merge request pipewire/pipewire!2446
This commit is contained in:
commit
a2fdb26d88
1 changed files with 7 additions and 2 deletions
|
|
@ -80,8 +80,13 @@ spa_pod_parser_deref(struct spa_pod_parser *parser, uint32_t offset, uint32_t si
|
|||
* to the next multiple of 8) is in bounds.
|
||||
*/
|
||||
if (SPA_IS_ALIGNED(pod, SPA_POD_ALIGN) &&
|
||||
long_offset + SPA_ROUND_UP_N((uint64_t)SPA_POD_BODY_SIZE(pod), SPA_POD_ALIGN) <= size)
|
||||
return (struct spa_pod *)pod;
|
||||
long_offset + SPA_ROUND_UP_N((uint64_t)SPA_POD_BODY_SIZE(pod), SPA_POD_ALIGN) <= size) {
|
||||
uint64_t zero = 0;
|
||||
size_t padding = SPA_POD_BODY_SIZE(pod) & 7;
|
||||
if (padding == 0 ||
|
||||
memcmp(SPA_PTROFF(pod, SPA_POD_SIZE(pod), void), &zero, 8 - padding) == 0)
|
||||
return (struct spa_pod *)pod;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue