Back to Skills

address-sanitizer

AddressSanitizer detects memory errors during fuzzing. Use when fuzzing C/C++ code to find buffer overflows and use-after-free bugs.

5,355stars472forksUpdated 5/24/2026

Security Assessment

Safe(100/100)
Security Score100/100

About address-sanitizer

AddressSanitizer (ASan) is a memory error detection tool designed to identify and report memory corruption issues in C/C++ programs during fuzzing and testing. It primarily addresses problems such as buffer overflows, use-after-free errors, double-free scenarios, and memory leaks, which are notoriously difficult to detect in complex codebases. By instrumenting code at compile time, ASan tracks memory allocation and access operations, providing detailed runtime reports whenever an illegal memory operation occurs. This enables developers and testers to catch critical vulnerabilities early in the development cycle, preventing crashes and potential security exploits in production environments.

ASan's main features include runtime instrumentation of memory operations, a shadow memory system that maps vast virtual memory to monitor allocation states, and a detection scope covering a wide range of memory safety violations. While it introduces a performance overhead of approximately 2-4x, it offers comprehensive diagnostic information, including stack traces and error types, that facilitate debugging and vulnerability remediation. Users can configure ASan behavior through environment variables, enabling verbosity, selective leak detection, and forced aborts on error to integrate seamlessly with fuzzing tools and testing frameworks. Its versatility extends to unit testing and code with unsafe blocks, making it a flexible solution for memory safety analysis.

ASan is particularly useful for developers, security researchers, and quality assurance engineers working with C/C++ or unsafe Rust code. It is most effective during fuzzing campaigns, debugging sessions focused on memory issues, and unit testing scenarios where memory corruption is suspected. The tool is generally not recommended for production use due to performance overhead and limited platform support on Windows and macOS. By leveraging ASan, teams can improve code reliability, reduce debugging time, and proactively identify vulnerabilities that could otherwise compromise software stability or security.

FAQ

How do I enable AddressSanitizer when compiling my code?

To enable ASan, compile and link your C/C++ code with the `-fsanitize=address` flag. For example: `clang -fsanitize=address -g -o my_program my_program.c`.

Which platforms are fully supported by ASan?

ASan has full support on Linux and partial support on Windows and macOS. Some features may be limited on non-Linux platforms.

Can I use ASan in production code?

No. ASan introduces significant runtime overhead and may expose additional attack surfaces. It is intended for testing and debugging, not production deployment.

How can I configure ASan options like verbosity or leak detection?

Use the `ASAN_OPTIONS` environment variable. For example, `export ASAN_OPTIONS=verbosity=1:abort_on_error=1:detect_leaks=0` allows you to set verbosity, force aborts on error, and disable leak detection.

What types of memory errors can ASan detect?

ASan detects buffer overflows, use-after-free errors, double-free issues, and memory leaks, providing detailed runtime reports to help identify and debug these problems.

Install address-sanitizer

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill