Undefined Behaviour is awesome!
summary
Covers concrete examples where undefined behavior lets the optimizer rewrite or remove code: integer overflow enables assuming x+1>x, a null dereference leads the compiler to delete whole paths and accidentally drop checks, missing return can make code fall into other functions and crash, and realloc/move create use-after-lifetime surprises. Demonstrates runtime and compile-time defenses like UBSan, AddressSanitizer, MemorySanitizer, valgrind, fwrapv/ftrapv and link-time options such as ThinLTO, and shows which fixes catch which bugs.
AI-written summary · about
chapters (19)
- 0:00Intro
- 0:12OUTLINE
- 0:36UNDEFINED BEHAVIOR UBI
- 6:09CALLING MAIN
- 7:18SIMPLE OVERFLOW
- 8:31CHECKING FOR OVERFLOW
- 9:12INTEGER OVERFLOWS + LOOPS
- 11:17INTEGER OVERFLOWS - MITIGATION
- 13:20UNINITIALIZED VALUES - MITIGATION
- 14:43REASONS FOR HAVING UNDEFINED BEHAVIOR
- 27:43DEREFERENCING NULL - MITIGATION
- 29:18FORGETTING RETURN STATEMENT
- 35:48BUFFER OVERFLOW - MITIGATION
- 36:36LET'S TALK ABOUT CONST
- 40:49THE SOLUTION
- 41:54LIFETIME AND POINTERS
- 46:43VIRTUAL FUNCTIONS - MITIGATION
- 47:54MISBEHAVING BEHAVIOR
- 49:51WRAPPING UP
related talks
46m“My Little Optimizer: Undefined Behavior is Magic"
58mGarbage In, Garbage Out: Arguing about Undefined Behavior...
19mExploiting Undefined Behavior in C/C++ Programs for Optimization: A Study on the(…)
13mUndefined, Unspecified, Non-deterministic, and Implementation Defined Behavior
18mDon't Look UB: Exposing Sanitizer-Eliding Compiler Optimizations
20mTowards Removing Undef Values from LLVM IR
22mCompilers should get over themselves and respect semantic dependencies!
19mProgram Reconditioning: Avoiding Undefined Behaviour When Finding and(…)
