Hasty Briefsbeta

Bilingual

Memory Safety’s Hardest Problem

14 hours ago
  • The hardest memory safety issue involves tagged unions where a pointer to internals of one variant is used after overwriting the union with a different variant, causing type confusion.
  • This type confusion problem also affects Ada, as shown in an example link.
  • In practice, the most exploitable memory errors are buffer overflows, which are trivially fixed with compiler-inserted bounds checks.
  • The industry's major missed opportunity was not adopting Walter Bright's proposed array syntax (e.g., char a[..]) earlier, which could have prevented many issues.