shithub: aubio

Download patch

ref: cf5c2cab070f74b64b043a179fb4dbd7e5fe7e20
parent: 4d445316e2997f0fc68a9b56086287dbe835d114
author: Paul Brossier <piem@piem.org>
date: Sun Feb 26 18:38:09 EST 2017

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

--- a/src/io/source_wavread.c
+++ b/src/io/source_wavread.c
@@ -295,6 +295,11 @@
 
 void aubio_source_wavread_readframe(aubio_source_wavread_t *s, uint_t *wavread_read) {
   unsigned char *short_ptr = s->short_output;
+  if (s->fid == NULL) {
+    fmat_zeros(s->output);
+    *wavread_read = 0;
+    return;
+  }
   size_t read = fread(short_ptr, s->blockalign, AUBIO_WAVREAD_BUFSIZE, s->fid);
   uint_t i, j, b, bitspersample = s->bitspersample;
   uint_t wrap_at = (1 << ( bitspersample - 1 ) );