From 97a5ac08f1500fb0159c38640e868565fb610408 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Fri, 7 Dec 2018 12:18:17 +0100 Subject: [PATCH] [timestretch] validate input hopsize and samplerate --- src/effects/timestretch_rubberband.c | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 { -- 2.11.0