I look at using CARingBuffer in the iPhone SDK 3.1 Developer \ Extras \ CoreAudio \ PublicUtility, however I was a bit puzzled by some of its methods. Firstly, it will only make sense to those who have used this class.
For example, the functions GetTimebounds, SetTimeBounds, ClipTimeBounds do what they actually do?
Also when using, I get crashes caused by an example of this method in the main Fetch method
-> ZeroABL (abl, 0, destStartOffset * mBytesPerFrame);
CARingBufferError CARingBuffer::Fetch(AudioBufferList *abl, UInt32 nFrames, SampleTime startRead)
{
SampleTime endRead = startRead + nFrames;
SampleTime startRead0 = startRead;
SampleTime endRead0 = endRead;
SampleTime size;
CARingBufferError err = ClipTimeBounds(startRead, endRead);
if (err) return err;
size = endRead - startRead;
SInt32 destStartOffset = startRead - startRead0;
if (destStartOffset > 0) {
ZeroABL(abl, 0, destStartOffset * mBytesPerFrame);
}
Here, destStartOffset becomes larger than the size of the abl Bufferlist, so when memset is executed, it exceeds the abl Bufferlist bounds causing the failure. Why has this class not received validation to prevent this?
source
share