Application crashes when using address sanitizer with MSVC

ASAN is still an experimental feature in MSVC. For this reason the clang_rt.asan_*.dll DLLs are not installed in System32 as part of the VC++ redistributable package.

As explained here, when using ASAN in shared CRT mode (/MDd), you need to ensure clang_rt.asan_dbg_dynamic-x86_64.dll and clang_rt.asan_dynamic-x86_64.dll are on the PATH.

You can either add C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29910\lib\x64 to the PATH or copy the DLLs to your project's output folder (side-by-side with your .exe).

Alternatively you can build in static CRT mode (e.g. /MTd), then also the ASAN lib will be embedded into the .exe.

Finally, as the warning suggests, use ASAN with Debug build type for better coverage:
cmake -DCMAKE_BUILD_TYPE=Debug ..