How to use msvc asan with visual studio


I tried enabling asan in project->properties->c/C++->Enable Address Sanitizer (Experimental) : Yes (/fsanitize=address).

I can then build my project, but when running it breaks at extern "C" void __cdecl _initterm(blah blah) in initterm.cpp with Exception thrown at 0x00007FFFCD3B2EB8 (ntdll.dll) in gnomes.exe: 0xC0000005: Access violation writing location 0x0000053747340000.

I've been told by others that this is a thing that happens, and I should continue through it. It then moves to ~50 or so other exceptions somewhere within ntdll.dll or other window api files, before eventually getting to my program, where it errors at the first line of main: GTApplication *app = new GTApplication(); (the first line of my main) with Access violation writing location blah.

So I'm unsure how to interpret this information. Is there something wrong with my foundational windows API layers on my computer? or is that just unavoidable (if weird) behavior. And does that mean I should interpret the first line of my program as also just a quirk of using asan? or is there something wrong with the allocation of my application object?

Am I using asan incorrectly?

asked on Stack Overflow Nov 1, 2020 by Phildo

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0