[vlc-devel] [vlc-commits] auhal: add missing bounds checking (close #10110)

Felix Paul Kühne fkuehne at videolan.org
Fri Dec 27 10:55:25 CET 2013

Hey David,

On 26.12.2013, at 21:42, David Fuhrmann <david.fuhrmann at gmail.com> wrote:

> Am 26.12.2013 um 17:35 schrieb Felix Paul Kühne <git at videolan.org>:
>> -        memcpy(targetBuffer, buffer, bytesToCopy);
>> -        TPCircularBufferConsume(&p_sys->circular_buffer, bytesToCopy);
>> -        ioData->mBuffers[0].mDataByteSize = bytesToCopy;
>> +        if (likely(bytesToCopy > 0)) {
> I assume that memcpy works fine if you enter a size of 0, so when can bytesToCopy < 0, if the circular buffer size is always >= 0?

Seeing the crash logs (~9,500 of them since the 2.1.2 release), memcpy doesn't really seem to like copying a zero buffer.

> So I assume this bug might be also just fixed with improved locking in your previous patch.

This should be the case, but for sakes of stability and since I can't be sure that there is no corner-case racing condition, I'd have an extra level of stability assurance here.

> And if this patch is actually needed: what about the SPDIF callback?

SPDIF is used way less than the "analog" output so logs may be rare. I'll scan the crash reports and adapt the alternative code path if needed.

Best regards,


More information about the vlc-devel mailing list