I'm trying to use Google sanitizers https://www.jetbrains.com/help/clion/google-sanitizers.html on my CMake project using CLion. I need to pass ASAN_OPTIONS=detect_container_overflow=0 environment variable so that Google sanitizers can pass on the container overflow error. I put "ASAN_OPTIONS=detect_container_overflow=0" in the Run/Debug configuration, but it didn't work, the sanitizer still halt at container_overflow errors and won't proceed.
So I added a new env variable TESTENV=testenv put the following lines in my program to check if it works:
const char* asan = std::getenv("ASAN_OPTIONS");
LOG(INFO) << fmt::format("ASAN_OPTIONS {}", asan);
const char* testEnv = std::getenv("TESTENV");
LOG(INFO) << fmt::format("TESTENV {}", testEnv);
The output does include TESTENV, but the output of ASAN_OPTIONS doesn't have detect_container_overflow=0:
I20220102 00:34:57.356257 966499840 test.cpp:148] ASAN_OPTIONS detect_stack_use_after_return=false log_path='/private/var/folders/rk/5dyjln0d4551nr1c6q7vz8mc0000gn/T/clion-sanitizersf4b4f3de-dbaf-4dc8-a2fb-fc5f7f2e6138/00f8647a-83ba-4e45-8f4e-2e0c0a45ef9f' stack_trace_format='pc_%p###func_%f###file_%s###line_%l###obj_%M' print_summary='true'
I20220102 00:34:57.356273 966499840 test.cpp:151] TESTENV testenv
I also tried ASAN_OPTIONS=$ASAN_OPTIONS:detect_container_overflow=0 but the output is the same. Can someone help?