Callers of get_host_address_range() rely on it returning a pointer to at least size bytes of memory. mem.get_host_address() is an overrideable method of a safe trait, so it is better for safe code to not rely on its correctness for safety. Instead, use mem.get_slice(), which returns a VolatileSlice whose invariants guarantee that it points to a sufficient amount of memory. If mem.check_range() succeeds but mem.get_slice() returns a slice that is too small, this means that there is either a logic error or a situation the code cannot support yet, so panic. Signed-off-by: Demi Marie Obenour <demiobenour@gmail.com> |
||
|---|---|---|
| .. | ||
| src | ||
| build.rs | ||
| Cargo.toml | ||