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

Unified Diff: webrtc/modules/audio_coding/codecs/isac/main/source/pitch_filter.c

Issue 2659383002: iSAC float decoder: Don't read past end of initialized part of buffer (Closed)
Patch Set: Use a compile-time check, because we can! Created 3 years, 11 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_coding/codecs/isac/main/source/pitch_filter.c
diff --git a/webrtc/modules/audio_coding/codecs/isac/main/source/pitch_filter.c b/webrtc/modules/audio_coding/codecs/isac/main/source/pitch_filter.c
index f03d230e65905df8e347a79bf379a5d86a9557fd..cdb30a74e708712d3e761be048078251efa7640c 100644
--- a/webrtc/modules/audio_coding/codecs/isac/main/source/pitch_filter.c
+++ b/webrtc/modules/audio_coding/codecs/isac/main/source/pitch_filter.c
@@ -16,6 +16,8 @@
#include "os_specific_inline.h"
+#include "webrtc/system_wrappers/include/compile_assert_c.h"
+
/*
* We are implementing the following filters;
*
@@ -275,6 +277,11 @@ static void FilterFrame(const double* in_data, PitchFiltstr* filter_state,
/* Copy states to local variables. */
memcpy(filter_parameters.buffer, filter_state->ubuf,
sizeof(filter_state->ubuf));
+ COMPILE_ASSERT(sizeof(filter_parameters.buffer) >=
+ sizeof(filter_state->ubuf));
+ memset(filter_parameters.buffer +
+ sizeof(filter_state->ubuf) / sizeof(filter_state->ubuf[0]),
+ 0, sizeof(filter_parameters.buffer) - sizeof(filter_state->ubuf));
memcpy(filter_parameters.damper_state, filter_state->ystate,
sizeof(filter_state->ystate));
« 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