c8966ad8626a — Chris Cannam tip 9 days ago
Correct calculation of dot_length in multi-channel case, fixing buffer overrun
1 files changed, 3 insertions(+), 1 deletions(-)

M src/BQResampler.cpp
M src/BQResampler.cpp +3 -1
@@ 600,7 600,9 @@ BQResampler::reconstruct_one(state *s) c
     int phase_length = pr.length;
     double result = 0.0;
 
-    int dot_length = min(phase_length, int(s->buffer.size()) - s->left);
+    int dot_length =
+        min(phase_length,
+            (int(s->buffer.size()) - s->left) / m_channels);
 
     if (m_dynamism == RatioMostlyFixed) {
         int phase_start = pr.start_index;