Skip to main content
← All terms
Glossary

MemorySanitizer (MSan)

A detector for uses of uninitialized memory in C/C++ programs, catching a class of bugs that ASan misses.

MemorySanitizer (MSan) is an LLVM instrumentation tool that tracks every bit of memory for initialization state and reports when uninitialized bytes flow into a conditional branch or are returned to the caller. Uninitialized reads are a common source of information-disclosure vulnerabilities — reading from uninitialized stack or heap bytes can leak cryptographic material or pointer values across security boundaries. MSan carries roughly 3x overhead and requires that all linked code (including system libraries) be compiled with MSan instrumentation; linking uninstrumented libraries produces false positives. For this reason, MSan is typically used in a dedicated fuzzing environment with a fully-instrumented libc. It should not be combined in the same build as AddressSanitizer — each sanitizer requires its own build.