From a152ad95d5e043182985c7a9951d70a482f91e1c Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 22 Jun 2021 09:15:53 +0200 Subject: [PATCH] filter: check port id and direction Don't crash in case someone tries to access invalid direction or port. --- src/pipewire/filter.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/pipewire/filter.c b/src/pipewire/filter.c index 33f08041c..746392604 100644 --- a/src/pipewire/filter.c +++ b/src/pipewire/filter.c @@ -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]; }