resample: don't copy too much

When we are in passthrough mode, copy only the min of input and
output size or else we might overread/overwrite.

See #875
This commit is contained in:
Wim Taymans 2021-03-09 12:47:38 +01:00
parent c0ab4b1b8d
commit fc044a37af

View file

@ -844,9 +844,10 @@ static int impl_node_process(void *object)
!SPA_FLAG_IS_SET(this->io_rate_match->flags, SPA_IO_RATE_MATCH_FLAG_ACTIVE)); !SPA_FLAG_IS_SET(this->io_rate_match->flags, SPA_IO_RATE_MATCH_FLAG_ACTIVE));
if (passthrough) { if (passthrough) {
uint32_t len = SPA_MIN(in_len, out_len);
for (i = 0; i < sb->n_datas; i++) for (i = 0; i < sb->n_datas; i++)
memcpy(dst_datas[i], src_datas[i], in_len * sizeof(float)); memcpy(dst_datas[i], src_datas[i], len * sizeof(float));
out_len = in_len; out_len = in_len = len;
} else { } else {
resample_process(&this->resample, src_datas, &in_len, dst_datas, &out_len); resample_process(&this->resample, src_datas, &in_len, dst_datas, &out_len);
} }