sanitizers

Enable and interpret compiler sanitizers for C/C++ memory errors.

159|20|Updated Feb 20, 2026
One-click install
npx skills add https://github.com/mohitmishra786/low-level-dev-skills --skill sanitizers-mohitmishra786
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: sanitizers
Source: https://github.com/mohitmishra786/low-level-dev-skills/tree/main/skills/runtimes/sanitizers
Command: npx skills add https://github.com/mohitmishra786/low-level-dev-skills --skill sanitizers-mohitmishra786

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps developers identify and fix runtime bugs like memory errors, undefined behavior, and data races by leveraging compiler sanitizers.

Core Features & Use Cases

  • Sanitizer Selection: Guides users on choosing the right sanitizer (ASan, UBSan, TSan, MSan, LSan) for specific bug classes.
  • Configuration & Enabling: Provides clear instructions and commands to enable sanitizers with GCC and Clang.
  • Report Interpretation: Explains how to understand and diagnose the output from various sanitizers.
  • Use Case: When your C++ program crashes with a segmentation fault, this Skill helps you enable AddressSanitizer to pinpoint the exact memory access error and its origin.

Quick Start

Use the sanitizers skill to help me understand an AddressSanitizer report about a heap-buffer-overflow.

Frequently Asked Questions about sanitizers

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I debug a segmentation fault in C++ using AddressSanitizer?

AddressSanitizer helps debug segmentation faults by instrumenting memory accesses to detect out-of-bounds reads or use-after-free. It provides a detailed report pinpointing the exact origin of the invalid memory access in C++ code.

What is the difference between ThreadSanitizer and MemorySanitizer for C++?

ThreadSanitizer detects data races in concurrent code, while MemorySanitizer identifies reads of uninitialized memory. Both are compiler runtime sanitizers used to isolate distinct classes of undefined behavior in C++ applications.

How do I enable UndefinedBehaviorSanitizer with GCC or Clang?

You enable UndefinedBehaviorSanitizer by passing specific flag configurations to your GCC or Clang compiler toolchain. This process instruments the binary to catch various forms of undefined behavior during execution.

How do I interpret a heap-buffer-overflow report from AddressSanitizer?

Interpreting an AddressSanitizer report involves reading the provided stack traces to locate the heap-buffer-overflow. The output analysis highlights the exact memory access error and its origin to facilitate debugging.

Why does my C++ program still crash after enabling LeakSanitizer?

LeakSanitizer specifically detects memory leaks, meaning your program may still crash due to other runtime errors like data races or undefined behavior. You must select the appropriate sanitizer matching your specific bug class.