Mercurial > hg > qm-dsp
diff dsp/transforms/FFT.cpp @ 395:a0829908bb74
Fix overrun in reading inverse complex-to-real FFT input (contrary to docs)
author | Chris Cannam <c.cannam@qmul.ac.uk> |
---|---|
date | Fri, 09 May 2014 14:35:46 +0100 |
parents | 650bbacf8288 |
children | 7ab3539e92e3 |
line wrap: on
line diff
--- a/dsp/transforms/FFT.cpp Tue May 06 10:35:01 2014 +0100 +++ b/dsp/transforms/FFT.cpp Fri May 09 14:35:46 2014 +0100 @@ -147,7 +147,10 @@ void inverse(const double *ri, const double *ii, double *ro) { - for (int i = 0; i < m_n; ++i) { + // kiss_fftr.h says + // "input freqdata has nfft/2+1 complex points" + + for (int i = 0; i < m_n/2 + 1; ++i) { m_c[i].r = ri[i]; m_c[i].i = ii[i]; }