gfx-rs / gfx

[maintenance mode] A low-overhead Vulkan-like GPU API for Rust.
http://gfx-rs.github.io/
Apache License 2.0
5.35k stars 551 forks source link

misaligned pointer in `queue::Queue::get` #3795

Open shinmao opened 9 months ago

shinmao commented 9 months ago

The source of unsoundness

https://github.com/gfx-rs/gfx/blob/bc77309afdb0829605982370a3e17382c5968071/src/backend/gl/src/queue.rs#L185-L189 We consider that queue::Queue::get is unsound because the program tried to cast u8 slice to f32/f64/i32 and created a unaligned pointer. The unaligned pointer was passed to slice::from_raw_parts which requires the guarantee of pointer's alignment.

cwfitzgerald commented 9 months ago

Thanks for the issue - gfx is in maintainence mode. If you can submit a PR we'll merge it, but otherwise I wouldn't expect this to be fixed.

maxwellflitton commented 5 months ago

@cwfitzgerald considering that this is in maintenance mode, is there another library that is actively maintained that is a GPU interface?

cwfitzgerald commented 5 months ago

If you want vulkan bindings, use https://crates.io/crates/ash, if you want a safe interface to the gpu, use https://crates.io/crates/wgpu