Added ASan/UBSan to CI, and fixed issues it found. (#445)

This commit is contained in:
Branimir Karadžić
2026-10-05 08:55:08 -07:00
committed by GitHub
parent 9521d0b5e2
commit 09cf98d55c
11 changed files with 154 additions and 32 deletions

View File

@@ -171,6 +171,11 @@ function toolchain(_buildDir, _libDir)
description = "Use AVX extension.",
}
newoption {
trigger = "with-sanitizers",
description = "Build with address and undefined behavior sanitizers (gcc/clang).",
}
-- Avoid error when invoking genie --help.
if (_ACTION == nil) then return false end
@@ -516,6 +521,20 @@ function toolchain(_buildDir, _libDir)
crtNone()
end
if _OPTIONS["with-sanitizers"] then
configuration { "linux-* or osx*" }
buildoptions {
"-fsanitize=address,undefined",
"-fno-sanitize-recover=all",
"-fno-omit-frame-pointer",
}
linkoptions {
"-fsanitize=address,undefined",
}
configuration {}
end
flags {
"NoPCH",
"NativeWChar",