From: Paul Brossier Date: Fri, 7 Dec 2018 11:18:17 +0000 (+0100) Subject: [timestretch] validate input hopsize and samplerate X-Git-Url: https://git.aubio.org/?a=commitdiff_plain;h=97a5ac08f1500fb0159c38640e868565fb610408;p=aubio.git [timestretch] validate input hopsize and samplerate --- diff --git a/src/effects/timestretch_rubberband.c b/src/effects/timestretch_rubberband.c index 39be8111..81fb2dc9 100644 --- a/src/effects/timestretch_rubberband.c +++ b/src/effects/timestretch_rubberband.c @@ -65,6 +65,16 @@ new_aubio_timestretch (const char_t * mode, smpl_t stretchratio, uint_t hopsize, 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 {