From 0cf6760ee0b770141fd8e2a086aefa336b9d291e Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 8 Sep 2021 16:22:55 +0200 Subject: [PATCH] resample: limit the amount of taps So that we don't allocate too much space but also don't cause an overflow in the indexes. --- spa/plugins/audioconvert/resample-native.c | 1 + 1 file changed, 1 insertion(+) diff --git a/spa/plugins/audioconvert/resample-native.c b/spa/plugins/audioconvert/resample-native.c index 87d5ed9be..a88aad07b 100644 --- a/spa/plugins/audioconvert/resample-native.c +++ b/spa/plugins/audioconvert/resample-native.c @@ -344,6 +344,7 @@ int resample_native_init(struct resample *r) scale = SPA_MIN(q->cutoff * out_rate / in_rate, 1.0); /* multiple of 8 taps to ease simd optimizations */ n_taps = SPA_ROUND_UP_N((uint32_t)ceil(q->n_taps / scale), 8); + n_taps = SPA_MIN(n_taps, 1u << 18); /* try to get at least 256 phases so that interpolation is * accurate enough when activated */