# HG changeset patch # User Chris Cannam # Date 1396345626 -3600 # Node ID da92a0abc7c6007c4b7b03e5c6aaaddb3a1bfa4f # Parent d501b52f95b6caf0da89ceace09116c6783cdcae Avoid overrunning yinBuffer array with tau+1 index diff -r d501b52f95b6 -r da92a0abc7c6 YinUtil.cpp --- 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]) {