rust/src/docs/transmuting_null.txt
2022-09-09 13:36:26 +02:00

15 lines
No EOL
435 B
Text

### What it does
Checks for transmute calls which would receive a null pointer.
### Why is this bad?
Transmuting a null pointer is undefined behavior.
### Known problems
Not all cases can be detected at the moment of this writing.
For example, variables which hold a null pointer and are then fed to a `transmute`
call, aren't detectable yet.
### Example
```
let null_ref: &u64 = unsafe { std::mem::transmute(0 as *const u64) };
```