Compile-Time Memory Safety in C

Twelve retrofits, one broken language

C, 1972

  • no bounds checks
  • no lifetime tracking
  • no runtime, on purpose

Fast, portable, and exactly as safe as the programmer writing it

The bill comes due

  • buffer overflow
  • use-after-free
  • double-free
  • uninitialised read

Five bug classes, forever, in every C codebase that has ever shipped

“Trust the programmer” was a design decision made for 1970s hardware. The hardware moved on. The decision didn’t.

This course is not “C is bad”

It’s: what has anyone actually built to keep C’s speed and reach while closing this gap — and what did each attempt have to give up to do it?

The shape of the semester

  • weeks 2–3: what compile-time checking can prove at all, and Rust as the target everyone else is measured against
  • weeks 4–10: seven real retrofits, from Cyclone to academic prototypes
  • week 11: one CVE, every tool, side by side
  • week 12: what’s actually shipping today

Before next week

Read up on Heartbleed (CVE-2014-0160) and Baron Samedit (CVE-2021-3156). Don’t chase the exploit chain — just find the two or three lines doing the damage.

See you in the studio

pnpm dev