History

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

Paul Brossier committed 10 years ago

Commit 99aa3531 parent 8147e031 file · +14 −0Browse files

Showing the changes to python (1 of 1 file). Show all

Unified · Split

python/ext/py-phasevoc.c+14−0
@@ -102,6 +102,13 @@ Py_pvoc_do(Py_pvoc * self, PyObject * args) · 101 unmodified lines
102102 return NULL;
103103 }
104104
105+ if (self->vecin.length != self->hop_s) {
106+ PyErr_Format(PyExc_ValueError,
107+ "input fvec has length %d, but pvoc expects length %d",
108+ self->vecin.length, self->hop_s);
109+ return NULL;
110+ }
111+
105112 Py_INCREF(self->output);
106113 if (!PyAubio_PyCvecToCCvec (self->output, &(self->c_output))) {
107114 return NULL;
@@ -131,6 +138,13 @@ Py_pvoc_rdo(Py_pvoc * self, PyObject * args) · 23 unmodified lines
131138 return NULL;
132139 }
133140
141+ if (self->cvecin.length != self->win_s / 2 + 1) {
142+ PyErr_Format(PyExc_ValueError,
143+ "input cvec has length %d, but pvoc expects length %d",
144+ self->cvecin.length, self->win_s / 2 + 1);
145+ return NULL;
146+ }
147+
134148 Py_INCREF(self->routput);
135149 if (!PyAubio_ArrayToCFvec(self->routput, &(self->c_routput)) ) {
136150 return NULL;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t