ref: a984461f81c2549a1df0d6c0160cfd5262ee2713
parent: abffec017c01c96f6aa7ade82c7b7a4c2ff0b56d
author: Paul Brossier <piem@piem.org>
date: Thu Aug 20 16:26:59 EDT 2015
src/spectral/fft.c: make sure winsize > 1
--- a/src/spectral/fft.c
+++ b/src/spectral/fft.c
@@ -119,6 +119,10 @@
aubio_fft_t * new_aubio_fft (uint_t winsize) {
aubio_fft_t * s = AUBIO_NEW(aubio_fft_t);
+ if ((sint_t)winsize < 1) {
+ AUBIO_ERR("fft: got winsize %d, but can not be < 1\n", winsize);
+ goto beach;
+ }
#ifdef HAVE_FFTW3
uint_t i;
s->winsize = winsize;
@@ -170,7 +174,7 @@
if (aubio_is_power_of_two(winsize) != 1) {
AUBIO_ERR("fft: can only create with sizes power of two,"
" requested %d\n", winsize);
- return NULL;
+ goto beach;
}
s->winsize = winsize;
s->fft_size = winsize / 2 + 1;
@@ -183,6 +187,9 @@
#endif /* HAVE_ACCELERATE */
#endif /* HAVE_FFTW3 */
return s;
+beach:
+ AUBIO_FREE(s);
+ return NULL;
}
void del_aubio_fft(aubio_fft_t * s) {