JUCE Demo Plugin VST3 crashes when using Address Sanitizer

In OS X 10.11.6, with Xcode 7.3.1, the JUCE Demo Plugin from tip (either master or develop branch), crashes when loaded as VST3 (for example in Tracktion 7.1.1) when built with Address Sanitizer enabled (in Xcode’s edit scheme / Diagnostics).

The crash isn’t the same each time but it happens shortly after adding enough parameters in initialiseMidiControllerMappings() to cause the *parameters.params array to resize. Adding parameters.init (10000); in JuceVST3EditController's constructor works around it and causes the crash not to happen. That’s all I could find so far.

I got to this when enabling address sanitizer to catch sporadic crashes with my plugin in AU but ended up finding this instead…

1 Like

Also something I can’t reproduce. I’m also on OS X 10.11.6, Xcode 7.3.1, Tracktion 7.1.1 with Adresss Sanitizer. I think this may be related to this bug as well (which we also can’t reproduce). Which VST3 SDK are you using? I’m on 3.6.6. Maybe this is causing the crashes?!?

I’ll investigate further…

Update: I downloaded Xcode 8.0 beta and with its Address Sanitizer everything was fine - though it did complain/crash when I ran it first time that I need to add a DYLD_INSERT_LIBRARIES to the command line for address sanitizer to work.

ERROR: Interceptors are not working. This may be because AddressSanitizer is loaded too late (e.g. via dlopen). Please launch the executable with:

Adding the equivalent DYLD_INSERT_LIBRARIES argument for the Xcode 7.3.1 built plugin, everything was fine also!
So I guess I just needed to learn how to properly use Address Sanitizer for plugins. Hopefully it will be of use when hunting other bugs.

1 Like

Thanks for the update.

1 Like

[quote=“yairadix, post:3, topic:18617, full:true”]Adding the equivalent DYLD_INSERT_LIBRARIES argument for the Xcode 7.3.1 built plugin, everything was fine also!

Would you mind letting me know how this is done? I don’t really have an understanding of this or what the Address Sanitizer is, but I’d appreciate the help to see if it’ll fix my issue above that Fabian linked.

If running the application from the terminal, add “DYLD_INSERT_LIBRARIES=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/7.3.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib” (if you used Xcode 7).
If you debug it via Xcode add this environment variable in the scheme.

1 Like

I added the scheme environment variable but it is still not working and producing that same error message.

I have ableton selected as my executable file… maybe this makes a difference?