shithub: aubio

Download patch

ref: 99aa35348d127d5d3582ad69d8f730b298766957
parent: 8147e0326751d6bb1d40befe627f77834eede320
author: Paul Brossier <piem@piem.org>
date: Mon May 2 08:05:39 EDT 2016

python/ext/py-phasevoc.c: add input size checks

--- a/python/ext/py-phasevoc.c
+++ b/python/ext/py-phasevoc.c
@@ -102,6 +102,13 @@
     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;
@@ -128,6 +135,13 @@
   }
 
   if (!PyAubio_PyCvecToCCvec (input, &(self->cvecin) )) {
+    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;
   }