From: Paul Brossier Date: Thu, 8 Oct 2009 00:02:11 +0000 (+0200) Subject: src/spectral/filterbank.c: make sure we don't read outside of boundaries X-Git-Tag: bzr2git~179 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=8fe9c106e1874e663091dd28e88dd2082db56217;p=aubio.git src/spectral/filterbank.c: make sure we don't read outside of boundaries --- diff --git a/src/spectral/filterbank.c b/src/spectral/filterbank.c index ac3d7e35..4a077c99 100644 --- a/src/spectral/filterbank.c +++ b/src/spectral/filterbank.c @@ -62,6 +62,7 @@ aubio_filterbank_do (aubio_filterbank_t * f, cvec_t * in, fvec_t * out) /* apply filter to all input channel, provided out has enough channels */ uint_t max_channels = MIN (in->channels, out->channels); uint_t max_filters = MIN (f->n_filters, out->length); + uint_t max_length = MIN (in->length, f->filters->length); /* reset all values in output vector */ fvec_zeros (out); @@ -73,7 +74,7 @@ aubio_filterbank_do (aubio_filterbank_t * f, cvec_t * in, fvec_t * out) for (fn = 0; fn < max_filters; fn++) { /* for each sample */ - for (j = 0; j < in->length; j++) { + for (j = 0; j < max_length; j++) { out->data[i][fn] += in->norm[i][j] * f->filters->data[fn][j]; } }