mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-21 07:00:08 -05:00
pod: handle builder overflows
When the builder is overflowed, we might get a NULL pod. This is a valid situation that we need to handle because it can be used to get the required builder buffer size.
This commit is contained in:
parent
7d4079b285
commit
0d1a18c054
1 changed files with 5 additions and 1 deletions
|
|
@ -131,7 +131,7 @@ spa_pod_filter_prop(struct spa_pod_builder *b,
|
||||||
const struct spa_pod_prop *p2)
|
const struct spa_pod_prop *p2)
|
||||||
{
|
{
|
||||||
const struct spa_pod *v1, *v2;
|
const struct spa_pod *v1, *v2;
|
||||||
struct spa_pod_choice *nc;
|
struct spa_pod_choice *nc, dummy;
|
||||||
uint32_t j, k, nalt1, nalt2;
|
uint32_t j, k, nalt1, nalt2;
|
||||||
void *alt1, *alt2, *a1, *a2;
|
void *alt1, *alt2, *a1, *a2;
|
||||||
uint32_t type, size, p1c, p2c;
|
uint32_t type, size, p1c, p2c;
|
||||||
|
|
@ -167,6 +167,10 @@ spa_pod_filter_prop(struct spa_pod_builder *b,
|
||||||
spa_pod_builder_prop(b, p1->key, p1->flags & p2->flags);
|
spa_pod_builder_prop(b, p1->key, p1->flags & p2->flags);
|
||||||
spa_pod_builder_push_choice(b, &f, 0, 0);
|
spa_pod_builder_push_choice(b, &f, 0, 0);
|
||||||
nc = (struct spa_pod_choice*)spa_pod_builder_frame(b, &f);
|
nc = (struct spa_pod_choice*)spa_pod_builder_frame(b, &f);
|
||||||
|
/* write to dummy value when builder overflows. We don't want to error
|
||||||
|
* because overflowing is a way to determine the required buffer size. */
|
||||||
|
if (nc == NULL)
|
||||||
|
nc = &dummy;
|
||||||
|
|
||||||
/* default value */
|
/* default value */
|
||||||
spa_pod_builder_primitive(b, v1);
|
spa_pod_builder_primitive(b, v1);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue