0Pricing
C++ Academy · Lesson

UBSan and TSan

Find undefined behavior and races.

Two More Sanitizers

Beyond ASan, two sanitizers target different bug classes.

  • UBSan: undefined behavior (overflow, bad shifts, null deref)
  • TSan: data races in multithreaded code

Enabling UBSan

UndefinedBehaviorSanitizer is enabled with -fsanitize=undefined. It can combine with ASan.

g++ -fsanitize=undefined -g main.cpp -o app
./app

All lessons in this course

  1. Using gdb and lldb
  2. AddressSanitizer
  3. UBSan and TSan
  4. Valgrind Basics
← Back to C++ Academy