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

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

Issue 2971313002: Add a check in the BlockBuffer of AEC2 to guard for buffer overflows. (Closed)
Patch Set: Move declaration of variable to point of first use. Created 3 years, 5 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 | « webrtc/common_audio/ring_buffer.c ('k') | 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.cc
diff --git a/webrtc/modules/audio_processing/aec/aec_core.cc b/webrtc/modules/audio_processing/aec/aec_core.cc
index 3155bad9728dfbe9d051492ca183c8859b02cfa3..f64617e5db0505fbd10aed29f20aab21ca91a641 100644
--- a/webrtc/modules/audio_processing/aec/aec_core.cc
+++ b/webrtc/modules/audio_processing/aec/aec_core.cc
@@ -206,15 +206,18 @@ void BlockBuffer::ExtractExtendedBlock(float extended_block[PART_LEN2]) {
// Extract the previous block.
WebRtc_MoveReadPtr(buffer_, -1);
- WebRtc_ReadBuffer(buffer_, reinterpret_cast<void**>(&block_ptr),
- &extended_block[0], 1);
+ size_t read_elements = WebRtc_ReadBuffer(
+ buffer_, reinterpret_cast<void**>(&block_ptr), &extended_block[0], 1);
+ RTC_CHECK_EQ(read_elements, 1);
if (block_ptr != &extended_block[0]) {
memcpy(&extended_block[0], block_ptr, PART_LEN * sizeof(float));
}
// Extract the current block.
- WebRtc_ReadBuffer(buffer_, reinterpret_cast<void**>(&block_ptr),
- &extended_block[PART_LEN], 1);
+ read_elements =
+ WebRtc_ReadBuffer(buffer_, reinterpret_cast<void**>(&block_ptr),
+ &extended_block[PART_LEN], 1);
+ RTC_CHECK_EQ(read_elements, 1);
if (block_ptr != &extended_block[PART_LEN]) {
memcpy(&extended_block[PART_LEN], block_ptr, PART_LEN * sizeof(float));
}
« no previous file with comments | « webrtc/common_audio/ring_buffer.c ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698