|
|
|
|
|
by _vvhw
1400 days ago
|
|
There is in fact a spectrum with respect to memory safety. For example, temporal vs spatial safety. Furthermore, no language is “memory safe” in the absolute sense. For example, not even the borrow checker can protect you from buffer bleeds. |
|
If one can use a use-after-free, invalid write, time of check-time of use error to write a byte to an invalid location, the program's data structures are now in an inconsistent state, violating invariants required for "spatial safety" such as objects being the correct type, buffers and lengths being paired together correctly, etc.
Likewise, if one can accomplish a buffer overflow, a spatial safety violation, or an out of bounds write, then by definition they've made temporal violations as well. Writing objects out of bounds or arbitrary heap writes imply data races.
Offensive security folks use gadgets that exploit one to accomplish the other, as needed.
[1] https://www.scattered-thoughts.net/writing/how-safe-is-zig/