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
This commit is contained in:
Wim Taymans 2022-01-09 16:56:42 +01:00
parent dc4cf163ef
commit 113ab31613

View file

@ -878,6 +878,11 @@ static int impl_node_process(void *object)
src_datas = alloca(sizeof(void*) * this->resample.channels); src_datas = alloca(sizeof(void*) * this->resample.channels);
dst_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) { if (size == 0) {
size = MAX_SAMPLES * sizeof(float); size = MAX_SAMPLES * sizeof(float);
for (i = 0; i < sb->n_datas; i++) for (i = 0; i < sb->n_datas; i++)