shithub: aubio

Download patch

ref: cc469dd6c9b7fb66eabb4cde0929270bb54a4f7d
parent: 2296ffbfd85b62393bb1af8a5a52fa5488e98dc0
author: Paul Brossier <piem@piem.org>
date: Sun Feb 26 18:38:49 EST 2017

src/io/source_wavread.c: avoid seeking in closed file

--- a/src/io/source_wavread.c
+++ b/src/io/source_wavread.c
@@ -407,6 +407,10 @@
 
 uint_t aubio_source_wavread_seek (aubio_source_wavread_t * s, uint_t pos) {
   uint_t ret = 0;
+  if (s->fid == NULL) {
+    AUBIO_ERR("source_wavread: could not seek %s (file not opened?)\n", s->path, pos);
+    return AUBIO_FAIL;
+  }
   if ((sint_t)pos < 0) {
     AUBIO_ERR("source_wavread: could not seek %s at %d (seeking position should be >= 0)\n", s->path, pos);
     return AUBIO_FAIL;