From f14a78d83431facbbe9e350460e8116ef1c66f9e Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Sat, 8 Sep 2007 16:12:31 +0200 Subject: [PATCH] filterbank.c: make sure we never write out of input/output vectors in aubio_filterbank_do --- src/filterbank.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/filterbank.c b/src/filterbank.c index 32906151..212cf48b 100644 --- a/src/filterbank.c +++ b/src/filterbank.c @@ -169,9 +169,10 @@ void del_aubio_filterbank(aubio_filterbank_t * fb){ void aubio_filterbank_do(aubio_filterbank_t * f, cvec_t * in, fvec_t *out) { uint_t n, filter_cnt; - for(filter_cnt = 0; filter_cnt < f->n_filters; filter_cnt++){ + for(filter_cnt = 0; (filter_cnt < f->n_filters) + && (filter_cnt < out->length); filter_cnt++){ out->data[0][filter_cnt] = 0.f; - for(n = 0; n < f->win_s; n++){ + for(n = 0; n < in->length; n++){ out->data[0][filter_cnt] += in->norm[0][n] * f->filters[filter_cnt]->data[0][n]; } -- 2.26.2