AddressSanitizer (aka ASan) is a memory error detector for C/C++. It finds:
Each bullet point links to an example of what it looks like when ASan detects an error. They all start similar (ERROR: AddressSanitizer
...) except for Memory leaks (ERROR: LeakSanitizer...).
UndefinedBehaviorSanitizer (UBSan) is a fast undefined behavior detector. UBSan modifies the program at compile-time to catch various kinds of undefined behavior during program execution.
A list of available checks can be found here. The flag -fsanitize=undefined will perform all checks except for float-divide-by-zero
, unsigned-integer-overflow
, implicit-conversion
, local-bounds
and the nullability-*
group of checks.
Depending on the severity, error detection look like the following: