Mercurial > hg > svcore
changeset 1839:915d316a5609
Fix out of range access to magnitudes
author | Chris Cannam |
---|---|
date | Thu, 09 Apr 2020 14:59:05 +0100 |
parents | 403e961ec6ab |
children | 7faa08747f5e |
files | data/model/FFTModel.cpp |
diffstat | 1 files changed, 3 insertions(+), 1 deletions(-) [+] |
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]);