From cf5c2cab070f74b64b043a179fb4dbd7e5fe7e20 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Sun, 26 Feb 2017 23:38:09 +0100 Subject: [PATCH] src/io/source_wavread.c: avoid reading in closed file --- src/io/source_wavread.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/io/source_wavread.c b/src/io/source_wavread.c index 9ab9b9d4..7e3c212e 100644 --- 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_r 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 ) ); -- 2.11.0