AEC3: Signal dependent ERLE: adding bounds to the index used for accessing the filter frequency response.

In this CL bounds are added to the index used for accessing the filter frequency response. That vector has always a capacity in memory equal to the final number of blocks of the main filter. However, at the initial part of the call or after an echo path change, a transition phase is started and a filter with a lower number of blocks is used and, therefore, its size is lower than that capacity during that transition phase.

Bug: webrtc:10463
Change-Id: I6ebfdea43047a3fa993a27f2c52bb3024df84ffe
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/128777
Reviewed-by: Per Åhgren <peah@webrtc.org>
Commit-Queue: Jesus de Vicente Pena <devicentepena@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27264}
diff --git a/modules/audio_processing/aec3/signal_dependent_erle_estimator.cc b/modules/audio_processing/aec3/signal_dependent_erle_estimator.cc
index 6a8d7e3..dbe8e48 100644
--- a/modules/audio_processing/aec3/signal_dependent_erle_estimator.cc
+++ b/modules/audio_processing/aec3/signal_dependent_erle_estimator.cc
@@ -328,8 +328,10 @@
     std::array<float, kFftLengthBy2Plus1> H2_section;
     X2_section.fill(0.f);
     H2_section.fill(0.f);
+    const size_t block_limit = std::min(section_boundaries_blocks_[section + 1],
+                                        filter_frequency_response.size());
     for (size_t block = section_boundaries_blocks_[section];
-         block < section_boundaries_blocks_[section + 1]; ++block) {
+         block < block_limit; ++block) {
       std::transform(X2_section.begin(), X2_section.end(),
                      spectrum_render_buffer.buffer[idx_render].begin(),
                      X2_section.begin(), std::plus<float>());