Hacker ApprovedDepartments

UndefinedBehaviorSanitizer

Hacker Approved

Ranked 4 of 6 sanitizers by recommenders

Compiler instrumentation that makes a program abort with a clear error at runtime when it hits undefined behavior, so bugs are caught instead of hidden.

Compiler instrumentation that makes a program abort with a clear error at runtime when it hits undefined behavior, so bugs are caught instead of hidden.

12 people gave an opinion

recommend it
12
criticize it
0
approval share
100%
Each figure is one person. RecommendsCriticizes

Recommended in 5 of 13 months

  1. November 2025: recommended
  2. December 2025: not recommended
  3. January 2026: recommended
  4. February 2026: recommended
  5. March 2026: not recommended
  6. April 2026: not recommended
  7. May 2026: recommended
  8. June 2026: not recommended
  9. July 2026: not recommended
  10. August 2026: not recommended
  11. September 2026: not recommended
  12. October 2026: recommended
  13. November 2026: not recommended (month in progress)

Why it carries the badge

  • 12 people recommend itNeeds 10 or more, met.
  • Nobody criticizes itNeeds 2 to 1 or better, met.
  • Recommended in 5 of 13 monthsNeeds 4 or more, met.

The same three rules apply to every product, and the badge can’t be bought. How the badge works

What people say about it

The reasons people give, with the number of comments that give each one. Open a reason to read what they said.

Why people recommend it

Each mark is one comment

  • Catches undefined behavior at runtime

    “Under UBSan the program aborts with the runtime error, so the undefined behavior is caught rather than hidden.”

    Comment from 17 Feb 2026 in “What every compiler writer should know about programmers (Anton Ertl, 2015) [pdf]”

    “I'd be surprised if some combination of ASAN and UBSAN wouldn't catch this and similar dangling references”

    Comment from 30 Nov 2025 in “Hardening the C++ Standard Library at scale”

    “you should catch most trivial cases with e.g. ubsan”

    Comment from 20 May 2026 in “Everything in C is undefined behavior”
  • Clear error messages

    “Under UBSan the program aborts with the runtime error, so the undefined behavior is caught rather than hidden.”

    Comment from 17 Feb 2026 in “What every compiler writer should know about programmers (Anton Ertl, 2015) [pdf]”

    “It prints a nice error message about the exact issue as the author has shown.”

    Comment from 8 Feb 2026 in “The Little Bool of Doom”
  • Used in routine testing

    “build and test with sanitizers (ASAN, UBSAN, TSAN) when not measuring performance”

    Comment from 10 Oct 2026 in “C for Rust programmers”

    “a mandatory test pass running with UBSan/ASan/Valgrind”

    Comment from 22 Oct 2026 in “Rust Style Guide”

Other sanitizers people recommend

The four most recommended other sanitizers, with the same counts for each, so you can compare like for like. The tick on each bar marks the 2 to 1 line the badge needs.

UndefinedBehaviorSanitizer compared with 4 alternatives
ProductRecommendCriticizeApprovalMonthsOwnedBadge
Valgrind29878%13—Approved
Miri26390%12—Approved
AddressSanitizer21484%7—Approved
UndefinedBehaviorSanitizerThis page120100%5—Approved
Go race detector5183%4——
See all 6 sanitizers, ranked

What people said

11 of the 12 comments that mention it, newest first. Each links to the original comment.

“a mandatory test pass running with UBSan/ASan/Valgrind”

RecommendsComment from 22 Oct 2026 in “Rust Style Guide”

“UBSAN is also pragmatic enough to focus on the 'important' UB, and ignore the 'irrelevant' types of UB.”

RecommendsComment from 14 Oct 2026 in “Arena Allocators in C”

“build and test with sanitizers (ASAN, UBSAN, TSAN) when not measuring performance”

RecommendsComment from 10 Oct 2026 in “C for Rust programmers”

“You can run your code in ASAN in UBSAN nowadays”

RecommendsComment from 20 May 2026 in “Everything in C is undefined behavior”

“you still need to use ubsan (ie - fsanitize=undefined)”

RecommendsComment from 20 May 2026 in “Everything in C is undefined behavior”

“you should catch most trivial cases with e.g. ubsan”

RecommendsComment from 20 May 2026 in “Everything in C is undefined behavior”

“Under UBSan the program aborts with the runtime error, so the undefined behavior is caught rather than hidden.”

RecommendsComment from 17 Feb 2026 in “What every compiler writer should know about programmers (Anton Ertl, 2015) [pdf]”

“already have several years of production experience, in a mature ecosystem”

RecommendsComment from 16 Feb 2026 in “Zig – io_uring and Grand Central Dispatch std.Io implementations landed”

“It prints a nice error message about the exact issue as the author has shown.”

RecommendsComment from 8 Feb 2026 in “The Little Bool of Doom”

“clang-tidy, ASAN, UBSAN, LSAN, MSAN, and TSAN are AMAZING”

RecommendsComment from 13 Jan 2026 in “LLVM: The Bad Parts”

“I'd be surprised if some combination of ASAN and UBSAN wouldn't catch this and similar dangling references”

RecommendsComment from 30 Nov 2025 in “Hardening the C++ Standard Library at scale”

Counts come from 1,795,640 Hacker News comments, November 2025 to November 2026. How we count. Report a mistake.