pub unsafe trait ReadOverwrite: Read { }
Expand description
This marker trait declares that the Read trait is implemented correctly, that means:
- implementation of
read()
andread_exact()
doesn’t read from provided buffer. - if
read()
returnsOk(n)
, then each of firstn
bytes was overwritten. - if
read_exact()
returnsOk(())
then each byte of buffer was overwritten.
Breaking this should not cause huge problems since untrusted input should be checked anyway but it might leak internal state of the application, containing secret data like private keys. Think of the Hartbleed bug.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.