changeset 62:da92a0abc7c6 tony

Avoid overrunning yinBuffer array with tau+1 index
author Chris Cannam
date Tue, 01 Apr 2014 10:47:06 +0100
parents d501b52f95b6
children 8180299e5087
files YinUtil.cpp
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/YinUtil.cpp	Tue Apr 01 10:38:39 2014 +0100
+++ b/YinUtil.cpp	Tue Apr 01 10:47:06 2014 +0100
@@ -273,7 +273,7 @@
     // 
     // std::cerr << tau << " " << currThreshInd << " "<< thresholds[currThreshInd] << " " << distribution[currThreshInd] << std::endl;
     float sumProb = 0;
-    while (tau < maxTau)
+    while (tau+1 < maxTau)
     {
         if (yinBuffer[tau] < thresholds[thresholds.size()-1] && yinBuffer[tau+1] < yinBuffer[tau])
         {