When building with -fsanitize=address I sometimes see bad memory access issues from libc++ classes.
The errors do not appear to be repeatable from run-to-run and sometimes do not happen at all.
What is happening? How can I prevent this?
"If libc++ containers cross from instrumented (rebuilt with ASan) to non-instrumented code, Address Sanitizer might report container overflow false positives."
If your program is linking with libraries built with libc++ without ASAN then you need to define
_LIBCXX_HAS_NO_ASAN when building.