shithub: aubio

Download patch

ref: 05a8c183b3ec302f8e5979626f322632dc610534
parent: 53bb4da5d8af1bf85d8af529eb3c37c025c29d5d
author: Paul Brossier <[email protected]>
date: Sun Feb 26 18:36:21 EST 2017

src/io/source_sndfile.c: make sure seek position is >= 0

--- a/src/io/source_sndfile.c
+++ b/src/io/source_sndfile.c
@@ -300,6 +300,11 @@
         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));