python/ext/py-fft.c: check input has correct size
authorPaul Brossier <piem@piem.org>
Sat, 30 Apr 2016 04:20:41 +0000 (06:20 +0200)
committerPaul Brossier <piem@piem.org>
Sat, 30 Apr 2016 04:20:41 +0000 (06:20 +0200)
python/ext/py-fft.c

index 93094a4..de05ef7 100644 (file)
@@ -85,6 +85,13 @@ Py_fft_do(Py_fft * self, PyObject * args)
     return NULL;
   }
 
+  if (self->vecin.length != self->win_s) {
+    PyErr_Format(PyExc_ValueError,
+                 "input array has length %d, but fft has size %d",
+                 self->vecin.length, self->win_s);
+    return NULL;
+  }
+
   cvec_t c_out;
   Py_INCREF(self->doout);
   if (!PyAubio_PyCvecToCCvec(self->doout, &c_out)) {