projects
/
aubio.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
4506b0c
)
[notes] prevent null pointer dereference
author
Paul Brossier
<piem@piem.org>
Wed, 28 Nov 2018 12:40:46 +0000
(13:40 +0100)
committer
Paul Brossier
<piem@piem.org>
Wed, 28 Nov 2018 12:40:46 +0000
(13:40 +0100)
thanks to @niugx
src/notes/notes.c
patch
|
blob
|
history
diff --git
a/src/notes/notes.c
b/src/notes/notes.c
index
a3cc741
..
fab3f83
100644
(file)
--- a/
src/notes/notes.c
+++ b/
src/notes/notes.c
@@
-83,6
+83,7
@@
aubio_notes_t * new_aubio_notes (const char_t * method,
o->isready = 0;
o->onset = new_aubio_onset (onset_method, o->onset_buf_size, o->hop_size, o->samplerate);
o->isready = 0;
o->onset = new_aubio_onset (onset_method, o->onset_buf_size, o->hop_size, o->samplerate);
+ if (o->onset == NULL) goto fail;
if (o->onset_threshold != 0.) aubio_onset_set_threshold (o->onset, o->onset_threshold);
o->onset_output = new_fvec (1);
if (o->onset_threshold != 0.) aubio_onset_set_threshold (o->onset, o->onset_threshold);
o->onset_output = new_fvec (1);
@@
-99,6
+100,9
@@
aubio_notes_t * new_aubio_notes (const char_t * method,
o->note_buffer = new_fvec(o->median);
o->note_buffer2 = new_fvec(o->median);
o->note_buffer = new_fvec(o->median);
o->note_buffer2 = new_fvec(o->median);
+ if (!o->onset_output || !o->pitch_output ||
+ !o->note_buffer || !o->note_buffer2) goto fail;
+
o->curnote = -1.;
o->newnote = 0.;
o->curnote = -1.;
o->newnote = 0.;