diff data/model/FFTModel.cpp @ 1839:915d316a5609

Fix out of range access to magnitudes
author Chris Cannam
date Thu, 09 Apr 2020 14:59:05 +0100
parents 1b688ab5f1b3
children
line wrap: on
line diff
--- a/data/model/FFTModel.cpp	Thu Apr 09 11:23:17 2020 +0100
+++ b/data/model/FFTModel.cpp	Thu Apr 09 14:59:05 2020 +0100
@@ -223,7 +223,9 @@
 bool
 FFTModel::getMagnitudesAt(int x, float *values, int minbin, int count) const
 {
-    if (count == 0) count = getHeight();
+    if (count == 0) {
+        count = getHeight() - minbin;
+    }
     auto col = getFFTColumn(x);
     for (int i = 0; i < count; ++i) {
         values[i] = abs(col[minbin + i]);