Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hunting memory errors #52

Open
baconpaul opened this issue Dec 16, 2021 · 2 comments
Open

Hunting memory errors #52

baconpaul opened this issue Dec 16, 2021 · 2 comments

Comments

@baconpaul
Copy link
Collaborator

So this evening before bed I turned on the address sanitizers in clang.
To do this add to target_compile_options after the warning disablement -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer and add a

    target_link_options(${PROJECT_NAME} PUBLIC
            -fsanitize=address -fsanitize=undefined
            )

then i build and run the standalone and in a single instance if I just click back and forth on the shift and ctrl button at the top 10 times or so I get a crash and the following sanitizer output. Hard to trap this outside the sanitizer but putting it here in case it rings any bells.

2021-12-15 21:57:31.173887-0500 MoniqueMonosynth[91633:10470605] =================================================================
2021-12-15 21:57:31.173915-0500 MoniqueMonosynth[91633:10470605] ==91633==ERROR: AddressSanitizer: heap-use-after-free on address 0x00011666ab20 at pc 0x00010255f2d0 bp 0x00016d909470 sp 0x00016d909468
2021-12-15 21:57:31.173920-0500 MoniqueMonosynth[91633:10470605] READ of size 1 at 0x00011666ab20 thread T0
2021-12-15 21:57:31.173926-0500 MoniqueMonosynth[91633:10470605] pc_0x10255f2cc###func_juce::CharPointer_UTF8::isEmpty() const###file_juce_CharPointer_UTF8.h###line_73###obj_(MoniqueMonosynth:arm64+0x10006f2cc)
2021-12-15 21:57:31.173931-0500 MoniqueMonosynth[91633:10470605] pc_0x1032a92f0###func_juce::CharPointer_UTF8 juce::StringHolder::createFromCharPointer<juce::CharPointer_UTF8>(juce::CharPointer_UTF8)###file_juce_String.cpp###line_80###obj_(MoniqueMonosynth:arm64+0x100db92f0)
2021-12-15 21:57:31.173935-0500 MoniqueMonosynth[91633:10470605] pc_0x1032a904c###func_juce::String::String(juce::CharPointer_UTF8)###file_juce_String.cpp###line_349###obj_(MoniqueMonosynth:arm64+0x100db904c)
2021-12-15 21:57:31.174017-0500 MoniqueMonosynth[91633:10470605] pc_0x10320b740###func_juce::String::String(juce::CharPointer_UTF8)###file_juce_String.cpp###line_349###obj_(MoniqueMonosynth:arm64+0x100d1b740)
2021-12-15 21:57:31.174030-0500 MoniqueMonosynth[91633:10470605] pc_0x102c883a8###func_Monique_Ui_DualSlider::refresh()###file_monique_ui_ModulationSlider.cpp###line_651###obj_(MoniqueMonosynth:arm64+0x1007983a8)
2021-12-15 21:57:31.174035-0500 MoniqueMonosynth[91633:10470605] pc_0x102d6b844###func_Monique_Ui_Refresher::timerCallback()###file_monique_ui_Refresher.cpp###line_13###obj_(MoniqueMonosynth:arm64+0x10087b844)
2021-12-15 21:57:31.174039-0500 MoniqueMonosynth[91633:10470605] pc_0x104f7e4dc###func_juce::Timer::TimerThread::callTimers()###file_juce_Timer.cpp###line_114###obj_(MoniqueMonosynth:arm64+0x102a8e4dc)
2021-12-15 21:57:31.174044-0500 MoniqueMonosynth[91633:10470605] pc_0x104f7dcac###func_juce::Timer::TimerThread::CallTimersMessage::messageCallback()###file_juce_Timer.cpp###line_180###obj_(MoniqueMonosynth:arm64+0x102a8dcac)
2021-12-15 21:57:31.174095-0500 MoniqueMonosynth[91633:10470605] pc_0x104f9a89c###func_juce::MessageQueue::deliverNextMessage()###file_juce_osx_MessageQueue.h###line_81###obj_(MoniqueMonosynth:arm64+0x102aaa89c)
2021-12-15 21:57:31.174099-0500 MoniqueMonosynth[91633:10470605] pc_0x104f9a58c###func_juce::MessageQueue::runLoopCallback()###file_juce_osx_MessageQueue.h###line_92###obj_(MoniqueMonosynth:arm64+0x102aaa58c)
2021-12-15 21:57:31.174114-0500 MoniqueMonosynth[91633:10470605] pc_0x104f998e4###func_juce::MessageQueue::runLoopSourceCallback(void*)###file_juce_osx_MessageQueue.h###line_100###obj_(MoniqueMonosynth:arm64+0x102aa98e4)
2021-12-15 21:57:31.174118-0500 MoniqueMonosynth[91633:10470605] pc_0x1a5590bb8###func___CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__###file_<null>###line_155611696###obj_(CoreFoundation:arm64e+0x84bb8)
2021-12-15 21:57:31.174122-0500 MoniqueMonosynth[91633:10470605] pc_0x1a5590b04###func___CFRunLoopDoSource0###file_<null>###line_155611696###obj_(CoreFoundation:arm64e+0x84b04)
2021-12-15 21:57:31.174126-0500 MoniqueMonosynth[91633:10470605] pc_0x1a55907f0###func___CFRunLoopDoSources0###file_<null>###line_155611696###obj_(CoreFoundation:arm64e+0x847f0)
2021-12-15 21:57:31.174129-0500 MoniqueMonosynth[91633:10470605] pc_0x1a558f164###func___CFRunLoopRun###file_<null>###line_155611696###obj_(CoreFoundation:arm64e+0x83164)
2021-12-15 21:57:31.174133-0500 MoniqueMonosynth[91633:10470605] pc_0x1a558e690###func_CFRunLoopRunSpecific###file_<null>###line_155611696###obj_(CoreFoundation:arm64e+0x82690)
2021-12-15 21:57:31.174136-0500 MoniqueMonosynth[91633:10470605] pc_0x1ae10498c###func_RunCurrentEventLoopInMode###file_<null>###line_155611696###obj_(HIToolbox:arm64e+0x3098c)
2021-12-15 21:57:31.174140-0500 MoniqueMonosynth[91633:10470605] pc_0x1ae104700###func_ReceiveNextEventCommon###file_<null>###line_155611696###obj_(HIToolbox:arm64e+0x30700)
2021-12-15 21:57:31.174143-0500 MoniqueMonosynth[91633:10470605] pc_0x1ae1044c0###func__BlockUntilNextEventMatchingListInModeWithFilter###file_<null>###line_155611696###obj_(HIToolbox:arm64e+0x304c0)
2021-12-15 21:57:31.174147-0500 MoniqueMonosynth[91633:10470605] pc_0x1a80e3ae8###func__DPSNextEvent###file_<null>###line_155611696###obj_(AppKit:arm64e+0x41ae8)
2021-12-15 21:57:31.174151-0500 MoniqueMonosynth[91633:10470605] pc_0x1a80e238c###func_-[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:]###file_<null>###line_155611696###obj_(AppKit:arm64e+0x4038c)
2021-12-15 21:57:31.174154-0500 MoniqueMonosynth[91633:10470605] pc_0x1a80d43ac###func_-[NSApplication run]###file_<null>###line_155611696###obj_(AppKit:arm64e+0x323ac)
2021-12-15 21:57:31.174158-0500 MoniqueMonosynth[91633:10470605] pc_0x104f404dc###func_juce::MessageManager::runDispatchLoop()###file_juce_mac_MessageManager.mm###line_359###obj_(MoniqueMonosynth:arm64+0x102a504dc)
2021-12-15 21:57:31.174162-0500 MoniqueMonosynth[91633:10470605] pc_0x104f40124###func_juce::JUCEApplicationBase::main()###file_juce_ApplicationBase.cpp###line_262###obj_(MoniqueMonosynth:arm64+0x102a50124)
2021-12-15 21:57:31.174166-0500 MoniqueMonosynth[91633:10470605] pc_0x104f3fc64###func_juce::JUCEApplicationBase::main(int, char const**)###file_juce_ApplicationBase.cpp###line_240###obj_(MoniqueMonosynth:arm64+0x102a4fc64)
2021-12-15 21:57:31.174169-0500 MoniqueMonosynth[91633:10470605] pc_0x1024f7a04###func_main###file_juce_audio_plugin_client_Standalone.cpp###line_47###obj_(MoniqueMonosynth:arm64+0x100007a04)
2021-12-15 21:57:31.174173-0500 MoniqueMonosynth[91633:10470605] pc_0x10906d0f0###func_start###file_<null>###line_155611696###obj_(dyld:arm64e+0x50f0)
2021-12-15 21:57:31.174177-0500 MoniqueMonosynth[91633:10470605] 
2021-12-15 21:57:31.174180-0500 MoniqueMonosynth[91633:10470605] 0x00011666ab20 is located 16 bytes inside of 27-byte region [0x00011666ab10,0x00011666ab2b)
2021-12-15 21:57:31.174183-0500 MoniqueMonosynth[91633:10470605] freed by thread T0 here:
2021-12-15 21:57:31.174187-0500 MoniqueMonosynth[91633:10470605] pc_0x10945ebc8###func_wrap__ZdaPv###file_<null>###line_155611696###obj_(libclang_rt.asan_osx_dynamic.dylib:arm64e+0x4abc8)
2021-12-15 21:57:31.174190-0500 MoniqueMonosynth[91633:10470605] pc_0x103426e18###func_juce::StringHolder::release(juce::StringHolder*)###file_juce_String.cpp###line_164###obj_(MoniqueMonosynth:arm64+0x100f36e18)
2021-12-15 21:57:31.174194-0500 MoniqueMonosynth[91633:10470605] pc_0x1032a5718###func_juce::StringHolder::release(juce::CharPointer_UTF8)###file_juce_String.cpp###line_169###obj_(MoniqueMonosynth:arm64+0x100db5718)
2021-12-15 21:57:31.174197-0500 MoniqueMonosynth[91633:10470605] pc_0x1032a550c###func_juce::String::~String()###file_juce_String.cpp###line_247###obj_(MoniqueMonosynth:arm64+0x100db550c)
2021-12-15 21:57:31.174201-0500 MoniqueMonosynth[91633:10470605] pc_0x1031ebd98###func_juce::String::~String()###file_juce_String.cpp###line_246###obj_(MoniqueMonosynth:arm64+0x100cfbd98)
2021-12-15 21:57:31.174207-0500 MoniqueMonosynth[91633:10470605] pc_0x102c1721c###func_MorphSLConfig::get_center_suffix() const###file_monique_ui_SliderConfig.h###line_6231###obj_(MoniqueMonosynth:arm64+0x10072721c)
2021-12-15 21:57:31.174211-0500 MoniqueMonosynth[91633:10470605] pc_0x102c88344###func_Monique_Ui_DualSlider::refresh()###file_monique_ui_ModulationSlider.cpp###line_651###obj_(MoniqueMonosynth:arm64+0x100798344)
2021-12-15 21:57:31.174215-0500 MoniqueMonosynth[91633:10470605] pc_0x102d6b844###func_Monique_Ui_Refresher::timerCallback()###file_monique_ui_Refresher.cpp###line_13###obj_(MoniqueMonosynth:arm64+0x10087b844)
2021-12-15 21:57:31.174218-0500 MoniqueMonosynth[91633:10470605] pc_0x104f7e4dc###func_juce::Timer::TimerThread::callTimers()###file_juce_Timer.cpp###line_114###obj_(MoniqueMonosynth:arm64+0x102a8e4dc)
2021-12-15 21:57:31.174222-0500 MoniqueMonosynth[91633:10470605] pc_0x104f7dcac###func_juce::Timer::TimerThread::CallTimersMessage::messageCallback()###file_juce_Timer.cpp###line_180###obj_(MoniqueMonosynth:arm64+0x102a8dcac)
2021-12-15 21:57:31.174225-0500 MoniqueMonosynth[91633:10470605] pc_0x104f9a89c###func_juce::MessageQueue::deliverNextMessage()###file_juce_osx_MessageQueue.h###line_81###obj_(MoniqueMonosynth:arm64+0x102aaa89c)
2021-12-15 21:57:31.174229-0500 MoniqueMonosynth[91633:10470605] pc_0x104f9a58c###func_juce::MessageQueue::runLoopCallback()###file_juce_osx_MessageQueue.h###line_92###obj_(MoniqueMonosynth:arm64+0x102aaa58c)
2021-12-15 21:57:31.174232-0500 MoniqueMonosynth[91633:10470605] pc_0x104f998e4###func_juce::MessageQueue::runLoopSourceCallback(void*)###file_juce_osx_MessageQueue.h###line_100###obj_(MoniqueMonosynth:arm64+0x102aa98e4)
2021-12-15 21:57:31.174236-0500 MoniqueMonosynth[91633:10470605] pc_0x1a5590bb8###func___CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__###file_<null>###line_155611696###obj_(CoreFoundation:arm64e+0x84bb8)
2021-12-15 21:57:31.174240-0500 MoniqueMonosynth[91633:10470605] pc_0x1a5590b04###func___CFRunLoopDoSource0###file_<null>###line_155611696###obj_(CoreFoundation:arm64e+0x84b04)
2021-12-15 21:57:31.174253-0500 MoniqueMonosynth[91633:10470605] pc_0x1a55907f0###func___CFRunLoopDoSources0###file_<null>###line_155611696###obj_(CoreFoundation:arm64e+0x847f0)
2021-12-15 21:57:31.174257-0500 MoniqueMonosynth[91633:10470605] pc_0x1a558f164###func___CFRunLoopRun###file_<null>###line_155611696###obj_(CoreFoundation:arm64e+0x83164)
2021-12-15 21:57:31.174260-0500 MoniqueMonosynth[91633:10470605] pc_0x1a558e690###func_CFRunLoopRunSpecific###file_<null>###line_155611696###obj_(CoreFoundation:arm64e+0x82690)
2021-12-15 21:57:31.174263-0500 MoniqueMonosynth[91633:10470605] pc_0x1ae10498c###func_RunCurrentEventLoopInMode###file_<null>###line_155611696###obj_(HIToolbox:arm64e+0x3098c)
2021-12-15 21:57:31.174267-0500 MoniqueMonosynth[91633:10470605] pc_0x1ae104700###func_ReceiveNextEventCommon###file_<null>###line_155611696###obj_(HIToolbox:arm64e+0x30700)
2021-12-15 21:57:31.174271-0500 MoniqueMonosynth[91633:10470605] pc_0x1ae1044c0###func__BlockUntilNextEventMatchingListInModeWithFilter###file_<null>###line_155611696###obj_(HIToolbox:arm64e+0x304c0)
2021-12-15 21:57:31.174274-0500 MoniqueMonosynth[91633:10470605] pc_0x1a80e3ae8###func__DPSNextEvent###file_<null>###line_155611696###obj_(AppKit:arm64e+0x41ae8)
2021-12-15 21:57:31.174278-0500 MoniqueMonosynth[91633:10470605] pc_0x1a80e238c###func_-[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:]###file_<null>###line_155611696###obj_(AppKit:arm64e+0x4038c)
2021-12-15 21:57:31.174282-0500 MoniqueMonosynth[91633:10470605] pc_0x1a80d43ac###func_-[NSApplication run]###file_<null>###line_155611696###obj_(AppKit:arm64e+0x323ac)
2021-12-15 21:57:31.174285-0500 MoniqueMonosynth[91633:10470605] pc_0x104f404dc###func_juce::MessageManager::runDispatchLoop()###file_juce_mac_MessageManager.mm###line_359###obj_(MoniqueMonosynth:arm64+0x102a504dc)
2021-12-15 21:57:31.174289-0500 MoniqueMonosynth[91633:10470605] pc_0x104f40124###func_juce::JUCEApplicationBase::main()###file_juce_ApplicationBase.cpp###line_262###obj_(MoniqueMonosynth:arm64+0x102a50124)
2021-12-15 21:57:31.174292-0500 MoniqueMonosynth[91633:10470605] pc_0x104f3fc64###func_juce::JUCEApplicationBase::main(int, char const**)###file_juce_ApplicationBase.cpp###line_240###obj_(MoniqueMonosynth:arm64+0x102a4fc64)
2021-12-15 21:57:31.174296-0500 MoniqueMonosynth[91633:10470605] pc_0x1024f7a04###func_main###file_juce_audio_plugin_client_Standalone.cpp###line_47###obj_(MoniqueMonosynth:arm64+0x100007a04)
2021-12-15 21:57:31.174306-0500 MoniqueMonosynth[91633:10470605] pc_0x10906d0f0###func_start###file_<null>###line_155611696###obj_(dyld:arm64e+0x50f0)
2021-12-15 21:57:31.174309-0500 MoniqueMonosynth[91633:10470605] 
2021-12-15 21:57:31.174312-0500 MoniqueMonosynth[91633:10470605] previously allocated by thread T0 here:
2021-12-15 21:57:31.174316-0500 MoniqueMonosynth[91633:10470605] pc_0x10945e7c8###func_wrap__Znam###file_<null>###line_155611696###obj_(libclang_rt.asan_osx_dynamic.dylib:arm64e+0x4a7c8)
2021-12-15 21:57:31.174319-0500 MoniqueMonosynth[91633:10470605] pc_0x1032a69d4###func_juce::StringHolder::createUninitialisedBytes(unsigned long)###file_juce_String.cpp###line_71###obj_(MoniqueMonosynth:arm64+0x100db69d4)
2021-12-15 21:57:31.174323-0500 MoniqueMonosynth[91633:10470605] pc_0x1032a7b54###func_juce::CharPointer_UTF8 juce::StringHolder::createFromCharPointer<juce::CharPointer_ASCII>(juce::CharPointer_ASCII)###file_juce_String.cpp###line_84###obj_(MoniqueMonosynth:arm64+0x100db7b54)
2021-12-15 21:57:31.174810-0500 MoniqueMonosynth[91633:10470605] pc_0x1032a7824###func_juce::String::String(char const*)###file_juce_String.cpp###line_303###obj_(MoniqueMonosynth:arm64+0x100db7824)
2021-12-15 21:57:31.174815-0500 MoniqueMonosynth[91633:10470605] pc_0x1031fd1a0###func_juce::String::String(char const*)###file_juce_String.cpp###line_304###obj_(MoniqueMonosynth:arm64+0x100d0d1a0)
2021-12-15 21:57:31.174818-0500 MoniqueMonosynth[91633:10470605] pc_0x102c17208###func_MorphSLConfig::get_center_suffix() const###file_monique_ui_SliderConfig.h###line_6231###obj_(MoniqueMonosynth:arm64+0x100727208)
2021-12-15 21:57:31.174822-0500 MoniqueMonosynth[91633:10470605] pc_0x102c88344###func_Monique_Ui_DualSlider::refresh()###file_monique_ui_ModulationSlider.cpp###line_651###obj_(MoniqueMonosynth:arm64+0x100798344)
2021-12-15 21:57:31.174825-0500 MoniqueMonosynth[91633:10470605] pc_0x102d6b844###func_Monique_Ui_Refresher::timerCallback()###file_monique_ui_Refresher.cpp###line_13###obj_(MoniqueMonosynth:arm64+0x10087b844)
2021-12-15 21:57:31.174843-0500 MoniqueMonosynth[91633:10470605] pc_0x104f7e4dc###func_juce::Timer::TimerThread::callTimers()###file_juce_Timer.cpp###line_114###obj_(MoniqueMonosynth:arm64+0x102a8e4dc)
2021-12-15 21:57:31.174846-0500 MoniqueMonosynth[91633:10470605] pc_0x104f7dcac###func_juce::Timer::TimerThread::CallTimersMessage::messageCallback()###file_juce_Timer.cpp###line_180###obj_(MoniqueMonosynth:arm64+0x102a8dcac)
2021-12-15 21:57:31.174850-0500 MoniqueMonosynth[91633:10470605] pc_0x104f9a89c###func_juce::MessageQueue::deliverNextMessage()###file_juce_osx_MessageQueue.h###line_81###obj_(MoniqueMonosynth:arm64+0x102aaa89c)
2021-12-15 21:57:31.174854-0500 MoniqueMonosynth[91633:10470605] pc_0x104f9a58c###func_juce::MessageQueue::runLoopCallback()###file_juce_osx_MessageQueue.h###line_92###obj_(MoniqueMonosynth:arm64+0x102aaa58c)
2021-12-15 21:57:31.174869-0500 MoniqueMonosynth[91633:10470605] pc_0x104f998e4###func_juce::MessageQueue::runLoopSourceCallback(void*)###file_juce_osx_MessageQueue.h###line_100###obj_(MoniqueMonosynth:arm64+0x102aa98e4)
2021-12-15 21:57:31.174877-0500 MoniqueMonosynth[91633:10470605] pc_0x1a5590bb8###func___CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__###file_<null>###line_155611696###obj_(CoreFoundation:arm64e+0x84bb8)
2021-12-15 21:57:31.174881-0500 MoniqueMonosynth[91633:10470605] pc_0x1a5590b04###func___CFRunLoopDoSource0###file_<null>###line_155611696###obj_(CoreFoundation:arm64e+0x84b04)
2021-12-15 21:57:31.174885-0500 MoniqueMonosynth[91633:10470605] pc_0x1a55907f0###func___CFRunLoopDoSources0###file_<null>###line_155611696###obj_(CoreFoundation:arm64e+0x847f0)
2021-12-15 21:57:31.174889-0500 MoniqueMonosynth[91633:10470605] pc_0x1a558f164###func___CFRunLoopRun###file_<null>###line_155611696###obj_(CoreFoundation:arm64e+0x83164)
2021-12-15 21:57:31.174894-0500 MoniqueMonosynth[91633:10470605] pc_0x1a558e690###func_CFRunLoopRunSpecific###file_<null>###line_155611696###obj_(CoreFoundation:arm64e+0x82690)
2021-12-15 21:57:31.174898-0500 MoniqueMonosynth[91633:10470605] pc_0x1ae10498c###func_RunCurrentEventLoopInMode###file_<null>###line_155611696###obj_(HIToolbox:arm64e+0x3098c)
2021-12-15 21:57:31.174902-0500 MoniqueMonosynth[91633:10470605] pc_0x1ae104700###func_ReceiveNextEventCommon###file_<null>###line_155611696###obj_(HIToolbox:arm64e+0x30700)
2021-12-15 21:57:31.174906-0500 MoniqueMonosynth[91633:10470605] pc_0x1ae1044c0###func__BlockUntilNextEventMatchingListInModeWithFilter###file_<null>###line_155611696###obj_(HIToolbox:arm64e+0x304c0)
2021-12-15 21:57:31.174923-0500 MoniqueMonosynth[91633:10470605] pc_0x1a80e3ae8###func__DPSNextEvent###file_<null>###line_155611696###obj_(AppKit:arm64e+0x41ae8)
2021-12-15 21:57:31.174930-0500 MoniqueMonosynth[91633:10470605] pc_0x1a80e238c###func_-[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:]###file_<null>###line_155611696###obj_(AppKit:arm64e+0x4038c)
2021-12-15 21:57:31.174934-0500 MoniqueMonosynth[91633:10470605] pc_0x1a80d43ac###func_-[NSApplication run]###file_<null>###line_155611696###obj_(AppKit:arm64e+0x323ac)
2021-12-15 21:57:31.174937-0500 MoniqueMonosynth[91633:10470605] pc_0x104f404dc###func_juce::MessageManager::runDispatchLoop()###file_juce_mac_MessageManager.mm###line_359###obj_(MoniqueMonosynth:arm64+0x102a504dc)
2021-12-15 21:57:31.174941-0500 MoniqueMonosynth[91633:10470605] pc_0x104f40124###func_juce::JUCEApplicationBase::main()###file_juce_ApplicationBase.cpp###line_262###obj_(MoniqueMonosynth:arm64+0x102a50124)
2021-12-15 21:57:31.174945-0500 MoniqueMonosynth[91633:10470605] pc_0x104f3fc64###func_juce::JUCEApplicationBase::main(int, char const**)###file_juce_ApplicationBase.cpp###line_240###obj_(MoniqueMonosynth:arm64+0x102a4fc64)
2021-12-15 21:57:31.174950-0500 MoniqueMonosynth[91633:10470605] pc_0x1024f7a04###func_main###file_juce_audio_plugin_client_Standalone.cpp###line_47###obj_(MoniqueMonosynth:arm64+0x100007a04)
2021-12-15 21:57:31.174953-0500 MoniqueMonosynth[91633:10470605] pc_0x10906d0f0###func_start###file_<null>###line_155611696###obj_(dyld:arm64e+0x50f0)
2021-12-15 21:57:31.174957-0500 MoniqueMonosynth[91633:10470605] 
2021-12-15 21:57:31.174960-0500 MoniqueMonosynth[91633:10470605] SUMMARY: AddressSanitizer: heap-use-after-free juce_CharPointer_UTF8.h:73 in juce::CharPointer_UTF8::isEmpty() const
@baconpaul
Copy link
Collaborator Author

Oh huh so the line that allocates the freed memory is this

    StringRef get_center_suffix() const noexcept override
    {
        const float state = morhp_state->get_value();
        if( state <= 0.5 )
        {
            return String("L");
        }
        else
        {
            return String("R");
        }
    }

but that returns a stack object into a ref which then will get destructed incorrectly. (Why that api is string_ref is actually odd). If I change that to return "L" then the crash goes away. Let me send up a PR that does that for your consideration in your morning.

@baconpaul
Copy link
Collaborator Author

Oh huh line 3443 has the same problem and is harder to fix. I'll put a hack into my PR but probably we will want a different approach

baconpaul added a commit to baconpaul/monique-monosynth that referenced this issue Dec 16, 2021
The pattern

StringRef foo() { return String( "bar" ); }

can result in the string being freed before the ref is resolved.
Address sanitizer shows this as a problem, as described in surge-synthesizer#52.
I'm not sure if this fix is the right one or if we should instead
change the API to String rather than StringRef, and especially
the dynamic string one is iffy, but this at least squashes the
memory problem the sanitizer showed in single instance.
TommmyArn pushed a commit that referenced this issue Dec 16, 2021
The pattern

StringRef foo() { return String( "bar" ); }

can result in the string being freed before the ref is resolved.
Address sanitizer shows this as a problem, as described in #52.
I'm not sure if this fix is the right one or if we should instead
change the API to String rather than StringRef, and especially
the dynamic string one is iffy, but this at least squashes the
memory problem the sanitizer showed in single instance.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant