[openal] OpenAL fails with OSS on FreeBSD

Chris Robinson chris.kcat at gmail.com
Thu Dec 1 22:25:37 EST 2016

On 12/01/2016 06:19 PM, Yuri wrote:
> libc is optimized, but this shouldn't matter. You need
> to look at the size passed to memset. It looks like memset sets memory
> outside the allocated range.

It looks correct to me. The

NEW_OBJ(backend, ALCplaybackOSS)(device);

line gets expanded to

do {
     backend = ALCplaybackOSS_New(sizeof(ALCplaybackOSS));
         memset(backend, 0, sizeof(ALCplaybackOSS));
         ALCplaybackOSS_Construct(backend, device);
} while(0);

where ALCplaybackOSS_New just calls al_malloc (which is an aligned 
allocator). It's allocating the size of the type, clearing the same 
number of bytes to 0, then initializing the object.

> Another thing I can recommend is to run testcases under valgrind - its
> plugin memcheck. I am almost sure it will find problems.

valgrind doesn't show anything wrong when using OSS output with 
alstream, regardless if an explicit device name is requested. qTox 
doesn't seem to exist in Debian, so I can't test it myself. However, 
looking at the source:


I think there might be a bug. It's taking a QString, converting it to a 
UTF-8 QByteArray, and then using constData() to get a C-style string. I 
don't believe that's guaranteed to be null-terminated though, so if not 
it can have junk characters after the name and won't be recognized.

More information about the openal mailing list