From: Paul Brossier Date: Sun, 26 Feb 2017 22:36:21 +0000 (+0100) Subject: src/io/source_sndfile.c: make sure seek position is >= 0 X-Git-Tag: 0.4.5~95 X-Git-Url: https://git.aubio.org/?p=aubio.git;a=commitdiff_plain;h=05a8c183b3ec302f8e5979626f322632dc610534 src/io/source_sndfile.c: make sure seek position is >= 0 --- 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));