Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(435)

Unified Diff: webrtc/modules/audio_processing/aec/aec_core.c

Issue 1338993003: Added boundary check for array access as a short-term way of fixing the bug of out-of-bounds reads … (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/modules/audio_processing/aec/aec_core.c
diff --git a/webrtc/modules/audio_processing/aec/aec_core.c b/webrtc/modules/audio_processing/aec/aec_core.c
index 063201586ad48d7d3af34508c4d1874cb5363b8b..4c610220ee9d16f2bcc2e242675de126610fedb5 100644
--- a/webrtc/modules/audio_processing/aec/aec_core.c
+++ b/webrtc/modules/audio_processing/aec/aec_core.c
@@ -820,8 +820,11 @@ static void UpdateDelayMetrics(AecCore* self) {
// negative (anti-causal system) or larger than the AEC filter length.
{
int num_delays_out_of_bounds = self->num_delay_values;
+ const int histogram_length = sizeof( self->delay_histogram ) /
hlundin-webrtc 2015/09/14 07:17:43 No spaces inside parentheses. (3 places.) http://g
peah-webrtc 2015/09/14 07:27:19 Acknowledged.
+ sizeof( self->delay_histogram[0] );
for (i = lookahead; i < lookahead + self->num_partitions; ++i) {
- num_delays_out_of_bounds -= self->delay_histogram[i];
+ if ( i < histogram_length )
hlundin-webrtc 2015/09/14 07:17:43 Why not make this part of the loop criterion? Once
peah-webrtc 2015/09/14 07:27:20 Acknowledged.
+ num_delays_out_of_bounds -= self->delay_histogram[i];
}
self->fraction_poor_delays = (float)num_delays_out_of_bounds /
self->num_delay_values;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698