Disable ASAN global variable check in vctoolchain when using clang compiler. This can lead to false / positive with ASan mixing types of different size in its shadow space

(for instance, null character being shared for char and wchar_t but having different sizes (1 for char and 2 for wchar_t))

[REVIEW] [at]ben.woodhouse
#rnx
#rb ben.woodhouse

[CL 35467128 by mickael gilabert in ue5-main branch]
This commit is contained in:
mickael gilabert
2024-08-12 16:54:18 -04:00
parent d1d54bb720
commit dd691757ff

View File

@@ -614,6 +614,13 @@ namespace UnrealBuildTool
// Works for clang too.
Arguments.Add("/fsanitize=address");
if (Target.WindowsPlatform.Compiler.IsClang())
{
// Don't check global variables when address sanitizer is enabled. This can lead to false / positive with ASan mixing types of different size in its shadow space
// (for instance, null character being shared for char and wchar_t but having different sizes (1 for char and 2 for wchar_t))
Arguments.Add("-mllvm -asan-globals=0");
}
// Use the CRT allocator so that ASan is able to hook into it for better error
// detection.
AddDefinition(Arguments, "FORCE_ANSI_ALLOCATOR=1");