From: Paul Brossier Date: Mon, 2 May 2016 10:05:39 +0000 (+0200) Subject: python/ext/py-phasevoc.c: add input size checks X-Git-Tag: 0.4.4~300^2~146 X-Git-Url: https://git.aubio.org/?a=commitdiff_plain;h=99aa35348d127d5d3582ad69d8f730b298766957;p=aubio.git python/ext/py-phasevoc.c: add input size checks --- diff --git a/python/ext/py-phasevoc.c b/python/ext/py-phasevoc.c index 0c9e2c2b..71bb5d58 100644 --- a/python/ext/py-phasevoc.c +++ b/python/ext/py-phasevoc.c @@ -102,6 +102,13 @@ Py_pvoc_do(Py_pvoc * self, PyObject * args) return NULL; } + if (self->vecin.length != self->hop_s) { + PyErr_Format(PyExc_ValueError, + "input fvec has length %d, but pvoc expects length %d", + self->vecin.length, self->hop_s); + return NULL; + } + Py_INCREF(self->output); if (!PyAubio_PyCvecToCCvec (self->output, &(self->c_output))) { return NULL; @@ -131,6 +138,13 @@ Py_pvoc_rdo(Py_pvoc * self, PyObject * args) return NULL; } + if (self->cvecin.length != self->win_s / 2 + 1) { + PyErr_Format(PyExc_ValueError, + "input cvec has length %d, but pvoc expects length %d", + self->cvecin.length, self->win_s / 2 + 1); + return NULL; + } + Py_INCREF(self->routput); if (!PyAubio_ArrayToCFvec(self->routput, &(self->c_routput)) ) { return NULL;