[Vm-dev] [OpenSmalltalk/opensmalltalk-vm] 521c75: Minor fix in iOS sound plugin
Nicolas Cellier
noreply at github.com
Sat Sep 21 18:59:51 UTC 2019
Branch: refs/heads/Cog
Home: https://github.com/OpenSmalltalk/opensmalltalk-vm
Commit: 521c75a865409cb6cfd31734452e5af71722031f
https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/521c75a865409cb6cfd31734452e5af71722031f
Author: Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com>
Date: 2019-09-21 (Sat, 21 Sep 2019)
Changed paths:
M platforms/iOS/plugins/SoundPlugin/sqSqueakSoundCoreAudio.m
Log Message:
-----------
Minor fix in iOS sound plugin
Two things:
1) according to https://developer.apple.com/documentation/audiotoolbox/kaudioqueueproperty_isrunning
the property is a UInt32, not a sqInt (a sqInt can be 64 bits long, thus might be not entirely set)
2) nothing tells that the value is a valid boolean value, only that is running if != 0
if I compile with -fsanitize=undefined, i get this:
>Process 5149 stopped
>* thread #9, name = 'com.apple.coreaudio.AQClient', stop reason = Invalid bool load
> frame #0: 0x000000010090b230 libclang_rt.ubsan_osx_dynamic.dylib`__ubsan_on_report
> libclang_rt.ubsan_osx_dynamic.dylib`__ubsan_on_report:
> -> 0x10090b230 <+0>: pushq %rbp
> 0x10090b231 <+1>: movq %rsp, %rbp
> 0x10090b234 <+4>: popq %rbp
> 0x10090b235 <+5>: retq
>Target 0: (Squeak) stopped.
>(lldb) bt
>* thread #9, name = 'com.apple.coreaudio.AQClient', stop reason = Invalid bool load
> * frame #0: 0x000000010090b230 libclang_rt.ubsan_osx_dynamic.dylib`__ubsan_on_report
> frame #1: 0x0000000100905f6c libclang_rt.ubsan_osx_dynamic.dylib`__ubsan::Diag::~Diag() + 140
> frame #2: 0x0000000100909ab9 libclang_rt.ubsan_osx_dynamic.dylib`handleLoadInvalidValue(__ubsan::InvalidValueData*, unsigned long, __ubsan::ReportOptions) + 505
> frame #3: 0x00000001009098b4 libclang_rt.ubsan_osx_dynamic.dylib`__ubsan_handle_load_invalid_value + 68
> frame #4: 0x00000001004f36ef Squeak`-[sqSqueakSoundCoreAudio setOutputIsRunning:](self=0x00000001021183a0, _cmd="setOutputIsRunning:", outputIsRunning=110) at sqSqueakSoundCoreAudio.h:0
> frame #5: 0x00000001004ecc6e Squeak`MyAudioQueuePropertyListener(inUserData=0x00000001021183a0, inAQ=0x000000000141d000, inID=1634824814) at sqSqueakSoundCoreAudio.m:90
> frame #6: 0x00007fff412ff0b2 AudioToolbox`ClientAudioQueue::PropertyChanged(unsigned int) + 518
> frame #7: 0x00007fff412fed65 AudioToolbox`AQClientCallbackMessageReader::DispatchCallbacks(void const*, unsigned long) + 195
> frame #8: 0x00007fff412e6ac5 AudioToolbox`ClientAudioQueue::FetchAndDeliverPendingCallbacks(unsigned int) + 291
> frame #9: 0x00007fff412e6921 AudioToolbox`AQCallbackReceiver_CallbackNotificationsAvailable + 121
> frame #10: 0x00007fff412e66a5 AudioToolbox`_XCallbackNotificationsAvailable + 33
> frame #11: 0x00007fff412e64b2 AudioToolbox`mshMIGPerform + 230
> frame #12: 0x00007fff42967f39 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE1_PERFORM_FUNCTION__ + 41
> frame #13: 0x00007fff42967e85 CoreFoundation`__CFRunLoopDoSource1 + 533
> frame #14: 0x00007fff4295fa40 CoreFoundation`__CFRunLoopRun + 2848
> frame #15: 0x00007fff4295ec93 CoreFoundation`CFRunLoopRunSpecific + 483
> frame #16: 0x00007fff412c340a AudioToolbox`GenericRunLoopThread::Entry(void*) + 158
I think it's benign, but let's not depend on UB...
More information about the Vm-dev
mailing list