~/talk

Mistakes to avoid when writing a wrapper around a C library

Talkat RustFest Zürich 2017 · 2017-09-30..10-01· [rust, security]
slides:none on file

Shows the top 9 common pitfalls and concrete fixes when wrapping a C library: how to use catch_unwind for callbacks, when to mark types with repr(C), why mem::forget and leak checks break invariants, and why hidden globals (OpenAL, OpenGL, Windows thread state) defeat per-crate mutexes. Recommends writing a thin low-level wrapper first, illustrates live bugs from iterator/Ref implementations and panics, and gives practical runtime checks and API shapes that actually work.

AI-written summary · about

  1. 0:00Intro
  2. 0:30What is a wrapper
  3. 1:20Not catching rust panics
  4. 2:40Not testing on a large scale
  5. 3:40Assuming a certain layout
  6. 4:45Transmute tuples
  7. 5:27Highlevel abstraction
  8. 7:44When to view
  9. 11:27Lock API
  10. 13:00How to fix this
  11. 14:22Mistake 4 Hidden global variables
  12. 15:55New text mutex
  13. 16:47Why it doesnt work
  14. 18:02Conclusion
  15. 19:59Read primitives from memory
  16. 22:11Mistake 2 assuming threat implementations are bugfree
  17. 24:05The problem
  18. 24:43Why would someone do this
  19. 26:00How to solve this
  20. 27:17Other examples
  21. 28:21Mistake 1 API related
  22. 29:23Mistake 2 API related
  23. 31:17Conclusions
  24. 32:10Question
~/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.