filter: check port id and direction

Don't crash in case someone tries to access invalid direction or
port.
This commit is contained in:
Wim Taymans 2021-06-22 09:15:53 +02:00
parent 28a9253622
commit a152ad95d5

View file

@ -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)
{
if ((direction != SPA_DIRECTION_INPUT && direction != SPA_DIRECTION_OUTPUT) ||
port_id >= MAX_PORTS)
return NULL;
return filter->ports[direction][port_id];
}