mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-21 08:56:56 -05:00
filter: check port id and direction
Don't crash in case someone tries to access invalid direction or port.
This commit is contained in:
parent
28a9253622
commit
a152ad95d5
1 changed files with 3 additions and 0 deletions
|
|
@ -310,6 +310,9 @@ static struct port *alloc_port(struct filter *filter,
|
||||||
|
|
||||||
static inline struct port *get_port(struct filter *filter, enum spa_direction direction, uint32_t port_id)
|
static inline struct port *get_port(struct filter *filter, enum spa_direction direction, uint32_t port_id)
|
||||||
{
|
{
|
||||||
|
if ((direction != SPA_DIRECTION_INPUT && direction != SPA_DIRECTION_OUTPUT) ||
|
||||||
|
port_id >= MAX_PORTS)
|
||||||
|
return NULL;
|
||||||
return filter->ports[direction][port_id];
|
return filter->ports[direction][port_id];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue