From d308c8aeb75263f14124f729b7886eec7856f11b Mon Sep 17 00:00:00 2001 From: "Grzegorz Szwoch (sound)" Date: Thu, 22 Apr 2021 11:47:58 +0200 Subject: [PATCH] Fix out-of-bounds read in LenPitShift --- include/LentPitShift.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/LentPitShift.h b/include/LentPitShift.h index 44e9300..dff5648 100644 --- a/include/LentPitShift.h +++ b/include/LentPitShift.h @@ -142,7 +142,7 @@ inline void LentPitShift::process() dpt[delay_] = dt[delay_] * delay_ / cumDt[delay_]; // Look for a minimum - if ( dpt[delay_-1]-dpt[delay_-2] < 0 && dpt[delay_]-dpt[delay_-1] > 0 ) { + if ( delay_ > 1 && dpt[delay_-1]-dpt[delay_-2] < 0 && dpt[delay_]-dpt[delay_-1] > 0 ) { // Check if the minimum is under the threshold if ( dpt[delay_-1] < threshold_ ){ lastPeriod_ = delay_-1;