projects
/
aubio.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
4d44531
)
src/io/source_wavread.c: avoid reading in closed file
author
Paul Brossier
<piem@piem.org>
Sun, 26 Feb 2017 22:38:09 +0000
(23:38 +0100)
committer
Paul Brossier
<piem@piem.org>
Sun, 26 Feb 2017 22:38:09 +0000
(23:38 +0100)
src/io/source_wavread.c
patch
|
blob
|
history
diff --git
a/src/io/source_wavread.c
b/src/io/source_wavread.c
index
9ab9b9d
..
7e3c212
100644
(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_r
void aubio_source_wavread_readframe(aubio_source_wavread_t *s, uint_t *wavread_read) {
unsigned char *short_ptr = s->short_output;
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 ) );
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 ) );