shithub: aubio

Download patch

ref: 97a5ac08f1500fb0159c38640e868565fb610408
parent: 9d8cedf592887f75a5889c6f9045daaa287c3235
author: Paul Brossier <piem@piem.org>
date: Fri Dec 7 07:18:17 EST 2018

[timestretch] validate input hopsize and samplerate

--- a/src/effects/timestretch_rubberband.c
+++ b/src/effects/timestretch_rubberband.c
@@ -65,6 +65,16 @@
   p->hopsize = hopsize;
   p->pitchscale = 1.;
 
+  if ((sint_t)hopsize <= 0) {
+    AUBIO_ERR("timestretch: hopsize should be > 0, got %d\n", hopsize);
+    goto beach;
+  }
+
+  if ((sint_t)samplerate <= 0) {
+    AUBIO_ERR("timestretch: samplerate should be > 0, got %d\n", samplerate);
+    goto beach;
+  }
+
   if (stretchratio <= MAX_STRETCH_RATIO && stretchratio >= MIN_STRETCH_RATIO) {
     p->stretchratio = stretchratio;
   } else {