From: Paul Brossier Date: Sat, 8 Sep 2007 14:12:31 +0000 (+0200) Subject: filterbank.c: make sure we never write out of input/output vectors in aubio_filterbank_do X-Git-Tag: bzr2git~442^2~17 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=f14a78d83431facbbe9e350460e8116ef1c66f9e;p=aubio.git filterbank.c: make sure we never write out of input/output vectors in aubio_filterbank_do --- 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]; }