Address sanitizer heap corruption in vkCreateInstance

When MSVC’s Address Sanitizer (ASan) is enabled, I get consistent crashes when trying to create a VkInstance.
I’ve attached a sample project that recreates the issue. The program simply attempts to create a vulkan instance and destroy it. However, during the call to vkCreateInstance, a heap corruption error is reported.

Based on the suggestion from other ASan-related posts, I tried to ensure the ASan runtime library was loaded before the Vulkan driver, but found no equivalent for LD_PRELOAD for MSVC. The output log does report the ASan runtime library being loaded before the Vulkan loader and driver.
I have also tried statically linking the runtime library (/MT and /MTd compile options), but the problem persists.

I have tested the smaple project with the following:
Microsoft Visual Studio 17.2.5 (MSVC version 14.32.31326)
Vulkan SDK version 1.3.216
NVidia driver version 516.40.

ASan_Vulkan.zip (3.1 KB)

1 Like

I’m having the same problem with the attached minimal working example (I’m including the CMake file I use to generate the solution to make it easier to reproduce).

The program terminates with an error code only for the Debug configuration (with ASan enabled) but terminates successfully if built using the Release configuration.

Tested using:
Microsoft Visual Studio 17.2.6 (solution generated using CMake 3.23.2)
Windows SDK version 10.0.19041.0 to target Windows 10.0.19044.
MSVC 19.32.31332.0
Vulkan SDK version 1.3.216
NVidia driver version 516.59

mwe.zip (931 Bytes)