[core] check index channel before accessing center_frequencies_

This commit is contained in:
Gaurav Singh 2020-02-01 06:41:17 -05:00
parent 24fd250d73
commit 15a09654f4

View File

@ -100,8 +100,8 @@ bool MfccMelFilterbank::Initialize(int input_length, double input_sample_rate,
if ((i < start_index_) || (i > end_index_)) {
band_mapper_[i] = -2; // Indicate an unused Fourier coefficient.
} else {
while ((center_frequencies_[channel] < melf) &&
(channel < num_channels_)) {
while ((channel < num_channels_) &&
(center_frequencies_[channel] < melf)) {
++channel;
}
band_mapper_[i] = channel - 1; // Can be == -1