~/talk

Undefined Behavior in the STL

Talkat CppCon 2022 · 2022-09-11..09-16· [security]
slides:none on file

Argues that undefined behavior lives inside the STL by design and gives concrete, actionable examples: bounds-checked at versus unchecked operator[] shows operator[] vs at: ~3x faster in benchmarks; dereferencing empty optional or returning a dangling string_view dangling produces unpredictable results; combining ranges with mismatched lengths or erased elements yields invalid iterators combine containers into memory chaos; building string from a null pointer behaves differently across compilers; recommends turning on warnings and sanitizers because UBSan catches many issues.

AI-written summary · about

  1. 0:00Introduction
  2. 3:57Roots of the Standard Template Library
  3. 8:54Program behaviors
  4. 15:18Undefined behavior dangers
  5. 19:20Benefits of UB in STL
  6. 20:02Container limits and iterators
  7. 28:47Missing or invalid data
  8. 32:45Invalid iterators in algorithms
  9. 34:35Old vs. modern ranges
  10. 48:55Vectors and iterators internals
  11. 51:12UB with unsorted data
  12. 55:32C++23 flat containers UB
  13. 56:38Other STL UB cases
  14. 1:00:41Mitigating undefined behavior in your code
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.