Mercurial > hg > svcore
comparison 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 |
comparison
equal
deleted
inserted
replaced
1838:403e961ec6ab | 1839:915d316a5609 |
---|---|
221 } | 221 } |
222 | 222 |
223 bool | 223 bool |
224 FFTModel::getMagnitudesAt(int x, float *values, int minbin, int count) const | 224 FFTModel::getMagnitudesAt(int x, float *values, int minbin, int count) const |
225 { | 225 { |
226 if (count == 0) count = getHeight(); | 226 if (count == 0) { |
227 count = getHeight() - minbin; | |
228 } | |
227 auto col = getFFTColumn(x); | 229 auto col = getFFTColumn(x); |
228 for (int i = 0; i < count; ++i) { | 230 for (int i = 0; i < count; ++i) { |
229 values[i] = abs(col[minbin + i]); | 231 values[i] = abs(col[minbin + i]); |
230 } | 232 } |
231 return true; | 233 return true; |