From 05a8c183b3ec302f8e5979626f322632dc610534 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Sun, 26 Feb 2017 23:36:21 +0100 Subject: [PATCH] src/io/source_sndfile.c: make sure seek position is >= 0 --- src/io/source_sndfile.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/io/source_sndfile.c b/src/io/source_sndfile.c index 76735936..4c830bad 100644 --- a/src/io/source_sndfile.c +++ b/src/io/source_sndfile.c @@ -300,6 +300,11 @@ uint_t aubio_source_sndfile_seek (aubio_source_sndfile_t * s, uint_t pos) { s->path); return AUBIO_FAIL; } + if ((sint_t)pos < 0) { + AUBIO_ERR("source_sndfile: could not seek %s at %d (seeking position" + " should be >= 0)\n", s->path, pos); + return AUBIO_FAIL; + } sf_ret = sf_seek (s->handle, resampled_pos, SEEK_SET); if (sf_ret == -1) { AUBIO_ERR("source_sndfile: Failed seeking %s at %d: %s\n", s->path, pos, sf_strerror (NULL)); -- 2.11.0