mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
client-node: improve memory checks
For MemPtr memory, we use the fd of the buffer metadata and chunk info. Check that the memory is also in this block. Check that all the memory of the buffer fits in the memory block. See #1859
This commit is contained in:
parent
d3cd36ab54
commit
cff8ac0cab
1 changed files with 8 additions and 2 deletions
|
|
@ -810,9 +810,15 @@ do_port_use_buffers(struct impl *impl,
|
||||||
}
|
}
|
||||||
for (j = 0; j < buffers[i]->n_datas; j++) {
|
for (j = 0; j < buffers[i]->n_datas; j++) {
|
||||||
struct spa_data *d = buffers[i]->datas;
|
struct spa_data *d = buffers[i]->datas;
|
||||||
if (d->type == SPA_DATA_MemPtr)
|
if (d->type == SPA_DATA_MemPtr) {
|
||||||
endptr = SPA_PTROFF(d->data, d->maxsize, void);
|
if ((m = pw_mempool_find_ptr(impl->context->pool, d->data)) == NULL ||
|
||||||
|
m != mem)
|
||||||
|
return -EINVAL;
|
||||||
|
endptr = SPA_MAX(endptr, SPA_PTROFF(d->data, d->maxsize, void));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
if (endptr > SPA_PTROFF(baseptr, mem->size, void))
|
||||||
|
return -EINVAL;
|
||||||
|
|
||||||
m = pw_mempool_import_block(this->client->pool, mem);
|
m = pw_mempool_import_block(this->client->pool, mem);
|
||||||
if (m == NULL)
|
if (m == NULL)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue