One Thousand Ways to Die in Rust FFI
summary
Taxonomy of common Rust FFI pitfalls, real-world examples and concrete fixes: implements OpenSSL APIs in missa link with 100% Rust code and reports 4.4 million monthly active users and a contribution to the curve project; demos show unchecked null pointers, panics crossing FFI, dangling returns from heap-allocated Strings, mismatched C char signedness, and allocator mismatches; recommends patterns like checking magic-bytes for opaque pointers, using catch_unwind, avoiding Box::into_raw across allocators, and tools such as cargo-clippy and whatwind.
AI-written summary · about
chapters (12)
- 0:00Introduction
- 2:05Google X Lab
- 2:56Outline
- 7:30Pointers
- 10:30Type Conversion
- 15:20Memory Leaks
- 19:36Copy from C
- 22:50Starter pointers
- 24:37External tools
- 25:01Resources
- 25:30Tips
- 26:35Questions
related talks
45mBuilding Safe and Secure Systems in Rust
58mRust for The Curious C++ Developers
01h 40mKeynote: An Introduction to Rust
31mUsing Rust from C... or Any Language
31mFrom C++ APIs to Idiomatic Rust: Wrapper Design Patterns
19mRust Without Tears: A Guide to Avoiding Common Traps
21mMind the Boundary: Detecting Undefined Behavior Across Rust’s FFI
30mEnsuring Rust Safety: Strategies for Managing Unsafe Rust
