silicon
silicon copied to clipboard
Unsoundness of `gaussian_blur`
I consider the gaussian_blur
have the unsound implementation in line 32
https://github.com/Aloxaf/silicon/blob/7837ec85e40a368d5fe0a61c47b5ad0be60359dd/src/blur.rs#L23-L33
Since RgbaImage
is a struct with repr(Rust)
, it means that it has an unstable layout and compiler preserves the right to insert any padding bytes around the fields.
When you cast the raw pointer of it to the pointer of Vec<u8>
, it could lead to incorrect data interpretation and uninitialized memory exposure since Vec<u8>
expects there are continuous bytes.