mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
client-node: don't overwrite the chunk memory pointer
When the client uploads a buffer, copy all data fields except for the chunk memory that we configured before. If we overwrite the chunk memory, the users of the buffer would not be able to find the chunk memory anymore and crash or fail.
This commit is contained in:
parent
9e44b957f0
commit
41989f4889
2 changed files with 12 additions and 6 deletions
|
|
@ -1024,11 +1024,19 @@ static int client_node_port_buffers(void *data,
|
|||
return -EINVAL;
|
||||
|
||||
for (j = 0; j < newbuf->n_datas; j++) {
|
||||
oldbuf->datas[j] = newbuf->datas[j];
|
||||
struct spa_chunk *oldchunk = oldbuf->datas[j].chunk;
|
||||
|
||||
spa_log_debug(this->log, " data %d type:%d fd:%d", j,
|
||||
/* overwrite everything except the chunk */
|
||||
oldbuf->datas[j] = newbuf->datas[j];
|
||||
oldbuf->datas[j].chunk = oldchunk;
|
||||
|
||||
spa_log_debug(this->log, " data %d type:%d fl:%08x fd:%d, offs:%d max:%d",
|
||||
j,
|
||||
newbuf->datas[j].type,
|
||||
(int) newbuf->datas[j].fd);
|
||||
newbuf->datas[j].flags,
|
||||
(int) newbuf->datas[j].fd,
|
||||
newbuf->datas[j].mapoffset,
|
||||
newbuf->datas[j].maxsize);
|
||||
}
|
||||
}
|
||||
mix->n_buffers = n_buffers;
|
||||
|
|
|
|||
|
|
@ -1062,9 +1062,7 @@ static int client_node_demarshal_port_buffers(void *object, const struct pw_prot
|
|||
for (i = 0; i < n_buffers; i++) {
|
||||
struct spa_buffer *buf = buffers[i] = alloca(sizeof(struct spa_buffer));
|
||||
|
||||
buf->n_metas = 0;
|
||||
buf->metas = NULL;
|
||||
|
||||
spa_zero(*buf);
|
||||
if (spa_pod_parser_get(&prs,
|
||||
SPA_POD_Int(&buf->n_datas), NULL) < 0)
|
||||
return -EINVAL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue