From 113ab3161347f9a3f1f972cdcf9c36796ea24986 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Sun, 9 Jan 2022 16:56:42 +0100 Subject: [PATCH] resample: limit input and output offsets Clamp the offsets to the max input and output sizes or we might end up with invalid len and crash. See #1994 --- spa/plugins/audioconvert/resample.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/spa/plugins/audioconvert/resample.c b/spa/plugins/audioconvert/resample.c index b175800e4..9000ed411 100644 --- a/spa/plugins/audioconvert/resample.c +++ b/spa/plugins/audioconvert/resample.c @@ -878,6 +878,11 @@ static int impl_node_process(void *object) src_datas = alloca(sizeof(void*) * this->resample.channels); dst_datas = alloca(sizeof(void*) * this->resample.channels); + if (inport->offset > size) + inport->offset = size; + if (outport->offset > maxsize) + outport->offset = maxsize; + if (size == 0) { size = MAX_SAMPLES * sizeof(float); for (i = 0; i < sb->n_datas; i++)