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

Unified Diff: webrtc/common_audio/ring_buffer.c

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.h ('k') | webrtc/modules/audio_processing/aec/aec_core.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/common_audio/ring_buffer.c
diff --git a/webrtc/common_audio/ring_buffer.c b/webrtc/common_audio/ring_buffer.c
index 5fc653bd57e53c774e923e23fd82eaa89a1e775f..5a91205118c46d11ccf3a6e56ccee8a56acf4197 100644
--- a/webrtc/common_audio/ring_buffer.c
+++ b/webrtc/common_audio/ring_buffer.c
@@ -118,7 +118,6 @@ size_t WebRtc_ReadBuffer(RingBuffer* self,
&buf_ptr_bytes_1,
&buf_ptr_2,
&buf_ptr_bytes_2);
-
if (buf_ptr_bytes_2 > 0) {
// We have a wrap around when reading the buffer. Copy the buffer data to
// |data| and point to it.
@@ -131,7 +130,7 @@ size_t WebRtc_ReadBuffer(RingBuffer* self,
}
if (data_ptr) {
// |buf_ptr_1| == |data| in the case of a wrap.
- *data_ptr = buf_ptr_1;
+ *data_ptr = read_count == 0 ? NULL : buf_ptr_1;
}
// Update read position
« no previous file with comments | « webrtc/common_audio/ring_buffer.h ('k') | webrtc/modules/audio_processing/aec/aec_core.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698