mirror of
https://gitlab.freedesktop.org/pipewire/pipewire
synced 2024-09-19 16:01:45 +00: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
|
@ -810,9 +810,15 @@ do_port_use_buffers(struct impl *impl,
|
|||
}
|
||||
for (j = 0; j < buffers[i]->n_datas; j++) {
|
||||
struct spa_data *d = buffers[i]->datas;
|
||||
if (d->type == SPA_DATA_MemPtr)
|
||||
endptr = SPA_PTROFF(d->data, d->maxsize, void);
|
||||
if (d->type == SPA_DATA_MemPtr) {
|
||||
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);
|
||||
if (m == NULL)
|
||||
|
|
Loading…
Reference in a new issue