shithub: aubio

Download patch

ref: c5ee1307bdc004e43302abeca1802c2692b33a8e
parent: 4506b0c590b1dffb6ff286cfb8ebb9e332085c9c
author: Paul Brossier <piem@piem.org>
date: Wed Nov 28 08:40:46 EST 2018

[notes] prevent null pointer dereference

thanks to @niugx

--- a/src/notes/notes.c
+++ b/src/notes/notes.c
@@ -83,6 +83,7 @@
   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);
 
@@ -98,6 +99,9 @@
   }
   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.;