From a2ab20a09888a88a7b58838474c13a29fa7188a7 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Sat, 14 May 2016 05:25:34 +0200 Subject: [PATCH] python/ext/py-source.c: check seek is not negative --- python/ext/py-source.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/python/ext/py-source.c b/python/ext/py-source.c index b9460702..82808686 100644 --- a/python/ext/py-source.c +++ b/python/ext/py-source.c @@ -251,11 +251,18 @@ Pyaubio_source_seek (Py_source *self, PyObject *args) { uint_t err = 0; - uint_t position; + int position; if (!PyArg_ParseTuple (args, "I", &position)) { return NULL; } + if (position < 0) { + PyErr_Format(PyExc_ValueError, + "error when seeking in source: can not seek to negative value %d", + position); + return NULL; + } + err = aubio_source_seek(self->o, position); if (err != 0) { PyErr_SetString (PyExc_ValueError, -- 2.11.0