From 9334e0339ec213f17dd16fd29b5b2b6df0aa2b07 Mon Sep 17 00:00:00 2001 From: Ahmet Inan Date: Mon, 12 Apr 2021 11:25:50 +0200 Subject: [PATCH] limit reading from input array to 0 .. samples-1 --- resampler.hh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/resampler.hh b/resampler.hh index 267f9c7..5f0c7b3 100644 --- a/resampler.hh +++ b/resampler.hh @@ -40,6 +40,8 @@ public: double x = i * ratio; int s0 = nearbyint(x); int s1 = s0 + TAPS; + if (s0 < 0 || s1 > samples) + continue; for (int s = s0; s < s1; ++s) { TYPE k = s - x; sum += lpf(k) * input[s * stride];