Fantastic C++ Bugs and How to Test Them
summary
Shows a concrete pcap included length bug where rewritten padding desynchronizes readers and is fixed with two code lines but protected by 150 lines of tests that reproduce write/read behavior. Demonstrates an NFS-only failure of renameat2 and a tempdir workaround, a sigbus from truncated mmap reproduced with 100-thread interleaving, a lazy-init use-after-free from double-checked locking exercised with a release-barrier of threads, and tests using LocalStack S3, dup/pipe stderr capture, and synthetic-throwing condition variables to prove strong exception safety.
AI-written summary · about
chapters (19)
- 0:00Unit tests beyond rules
- 1:27Pcap file bug origin
- 5:14One line needs 150 tests
- 8:26Unit tests systematize knowledge
- 10:12Testing versus unit testing
- 11:56Unit tests boost productivity
- 13:20Safe file system testing
- 15:26NFS rename bug isolation
- 17:53Fix bugs by making code testable
- 20:46Sigbus bug from truncation
- 24:59TOCTOU bugs and races
- 27:04Double-checked locking UAF
- 32:24Spurious wakeups in queues
- 36:35Legacy component cascading bugs
- 38:00Testing exception safety
- 41:11Testing networked apps
- 44:46Mocking global resources
- 49:19Trivial functions can have bugs
- 51:02Why write unit tests
related talks
52mNobody Can Program Correctly - Lessons From 20 Years of Debugging C++ Code
34mHidden in Plain Sight: Corner Case Defects
01h 01mAdvanced Unit Testing in C & C++
01h 01mBack to Basics: Debugging in Cpp
01h 01mBack to Basics: Debugging and Testing in C++ Software Development
12mUnderstanding and Finding Crash-Consistency Bugs in Parallel File Systems
34mHidden in Plain Sight: Corner Case Defects
28mExtreme OS Kernel Testing
