ExtAudioFileRead/Dispose - failures on El Capitan

I'm using the Extended Audio File Services to read in samples of an audio file.

Since the update to El Capitan, my app started failing in this area - and I don't know the reason.


Sometimes the failure occurs in ExtAudioFileRead:


Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x000000010a62e000
Exception Note:        EXC_CORPSE_NOTIFY

VM Regions Near 0x10a62e000:
    MALLOC_LARGE           000000010a5e7000-000000010a62e000 [  284K] rw-/rwx SM=PRV
--> Process Corpse Info    000000010a62e000-000000010a82e000 [ 2048K] rw-/rwx SM=COW
    __TEXT                 0000123440000000-0000123440860000 [ 8576K] r-x/rwx SM=COW  /System/Library/Extensions/GeForceGLDriver.bundle/Contents/MacOS/GeForceGLDriver

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libvDSP.dylib                 0x00007fff84945b9b 0x7fff8489c000 + 695195
1   com.apple.audio.codecs.Components 0x000000010a34a926 Reinterleave32f(float const* const*, float*, unsigned int, unsigned int) + 125
2   com.apple.audio.codecs.Components 0x000000010a34a6a7 InterleaveConvert(float const* const*, void* const*, unsigned int, unsigned int, bool, bool, float) + 112
3   com.apple.audio.codecs.Components 0x000000010a34bb59 AACDecoder::DecodeFrame(unsigned char const*, unsigned int, FrameOutRecord&) + 1249
4   com.apple.audio.codecs.Components 0x000000010a2da0f0 ACMP4AACBaseDecoder::ProduceOutputBufferList(AudioBufferList*, unsigned int&, AudioStreamPacketDescription*) + 168
5   com.apple.audio.codecs.Components 0x000000010a2da03b ACMP4AACBaseDecoder::ProduceOutputPackets(void*, unsigned int&, unsigned int&, AudioStreamPacketDescription*) + 53
6   com.apple.audio.codecs.Components 0x000000010a32868a ProduceOutputPackets(void*, void*, unsigned int*, unsigned int*, AudioStreamPacketDescription*, unsigned int*) + 23
7   com.apple.audio.toolbox.AudioToolbox 0x00007fff8eb2fd8e CodecConverter::DecoderFillBuffer(unsigned int&, AudioBufferList&, AudioStreamPacketDescription*) + 1134
8   com.apple.audio.toolbox.AudioToolbox 0x00007fff8eb2f711 AudioConverterChain::RenderOutput(CABufferList*, unsigned int, unsigned int&, AudioStreamPacketDescription*) + 99
9   com.apple.audio.toolbox.AudioToolbox 0x00007fff8eb2f52b BufferedAudioConverter::FillBuffer(unsigned int&, AudioBufferList&, AudioStreamPacketDescription*) + 281
10  com.apple.audio.toolbox.AudioToolbox 0x00007fff8eb2f23f AudioConverterFillComplexBuffer + 287
11  com.apple.audio.toolbox.AudioToolbox 0x00007fff8eb9729d ExtAudioFile::Read(unsigned int, unsigned int&, AudioBufferList*) + 445
12  com.apple.audio.toolbox.AudioToolbox 0x00007fff8eb8d3a7 ExtAudioFileRead + 102
13  pl.czak.myaudioapp               0x0000000102f7904a -[LAWaveform initWithURL:] + 474 (LAWaveform.m:57)


Sometimes the read succeeds, but ExtAudioFileDispose fails then:


Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Application Specific Information:
abort() called
*** error for object 0x7f81cb0d5408: incorrect checksum for freed object - object was probably modified after being freed.

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib         0x00007fff85c1c0ae __pthread_kill + 10
1   libsystem_pthread.dylib       0x00007fff8fcb5500 pthread_kill + 90
2   libsystem_c.dylib             0x00007fff8aaea37b abort + 129
3   libsystem_malloc.dylib         0x00007fff8dbe63a6 szone_error + 626
4   libsystem_malloc.dylib         0x00007fff8dbdc383 small_free_list_remove_ptr + 152
5   libsystem_malloc.dylib         0x00007fff8dbdaa8c szone_free_definite_size + 1790
6   com.apple.audio.toolbox.AudioToolbox 0x00007fff8eb94e66 ExtAudioFile::Close() + 284
7   com.apple.audio.toolbox.AudioToolbox 0x00007fff8eb8d2d5 ExtAudioFileDispose + 52
8   pl.czak.myaudioapp               0x0000000106b080c4 -[LAWaveform initWithURL:] + 596 (LAWaveform.m:64)


Other times, ExtAudioFileDispose fails, but the stacktrace is different:


Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Application Specific Information:
abort() called
*** error for object 0x7fd7e293e608: incorrect checksum for freed object - object was probably modified after being freed.

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib         0x00007fff85c1c0ae __pthread_kill + 10
1   libsystem_pthread.dylib       0x00007fff8fcb5500 pthread_kill + 90
2   libsystem_c.dylib             0x00007fff8aaea37b abort + 129
3   libsystem_malloc.dylib         0x00007fff8dbe63a6 szone_error + 626
4   libsystem_malloc.dylib         0x00007fff8dbdc383 small_free_list_remove_ptr + 152
5   libsystem_malloc.dylib         0x00007fff8dbdaa8c szone_free_definite_size + 1790
6   com.apple.audio.toolbox.AudioToolbox 0x00007fff8eb85304 Cached_DataSource::~Cached_DataSource() + 54
7   com.apple.audio.toolbox.AudioToolbox 0x00007fff8eb85058 Cached_DataSource::~Cached_DataSource() + 14
8   com.apple.audio.toolbox.AudioToolbox 0x00007fff8eaffd70 AudioFileObject::Close() + 24
9   com.apple.audio.toolbox.AudioToolbox 0x00007fff8ebc26c4 MP4AudioFile::Close() + 3298
10  com.apple.audio.toolbox.AudioToolbox 0x00007fff8eaffb3c AudioFileClose + 67
11  com.apple.audio.toolbox.AudioToolbox 0x00007fff8eb94e4a ExtAudioFile::Close() + 256
12  com.apple.audio.toolbox.AudioToolbox 0x00007fff8eb8d2d5 ExtAudioFileDispose + 52
13  pl.czak.myaudioapp               0x000000010244b0c4 -[LAWaveform initWithURL:] + 596 (LAWaveform.m:64)


The issue seems specific to M4A files with floating-point samples. This same code reads a 16-bit MP3 without an issue.

I have prepared an M4A file which crashes the app (despite being a perfectly valid audio file): http://czak.pl/upload/sample.m4a


The code runs correctly and consistently on Mavericks. I'm guessing the issue is buried somewhere deeper. But perhaps someone will be kind enough to suggest a workaround at least.

Bug number please...if you haven't filed one, please do with your test case and the media causing the crashes (important to include), so we can check it out.

ExtAudioFileRead/Dispose - failures on El Capitan
 
 
Q