Adding a check to ensure that the memcpy does not exceed bounds of the arrays.

Review URL: http://webrtc-codereview.appspot.com/290007

git-svn-id: http://webrtc.googlecode.com/svn/trunk@1055 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
punyabrata@webrtc.org 2011-11-29 18:49:54 +00:00
parent 1e91693fe2
commit c9801465b6

View File

@ -612,6 +612,14 @@ WebRtc_Word32 AudioDeviceBuffer::GetPlayoutData(WebRtc_Word8* audioBuffer)
{ {
CriticalSectionScoped lock(_critSect); CriticalSectionScoped lock(_critSect);
if (_playSize > kMaxBufferSizeBytes)
{
WEBRTC_TRACE(kTraceError, kTraceUtility, _id, "_playSize %i exceeds "
"kMaxBufferSizeBytes in AudioDeviceBuffer::GetPlayoutData", _playSize);
assert(false);
return -1;
}
memcpy(audioBuffer, &_playBuffer[0], _playSize); memcpy(audioBuffer, &_playBuffer[0], _playSize);
if (_playFile.Open()) if (_playFile.Open())