Skip to content

Commit

Permalink
Don't crash if an out-of-bounds read would occur
Browse files Browse the repository at this point in the history
  • Loading branch information
sbooth committed Jul 31, 2011
1 parent 726d8e6 commit 24ff88b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ThirdParty/PublicUtility/CARingBuffer.cpp
Expand Up @@ -261,7 +261,7 @@ CARingBufferError CARingBuffer::Fetch(AudioBufferList *abl, UInt32 nFrames, Samp
size = endRead - startRead;

// Don't perform out-of-bounds writes
if((startRead - startRead0) > nFrames || (endRead0 - endRead) > nFrames) {
if((startRead - startRead0) > nFrames || (endRead0 - endRead) > nFrames || startRead == endRead) {
ZeroABL(abl, 0, nFrames * mBytesPerFrame);
return noErr;
}
Expand Down

0 comments on commit 24ff88b

Please sign in to comment.