Gnurou / v4l2r

Rust bindings for V4L2
MIT License
21 stars 10 forks source link

Transmuting between `v4l2_plane__bindgen_ty_1` and `v4l2_buffer__bindgen_ty_1` is not safe #24

Closed Gnurou closed 4 months ago

Gnurou commented 4 months ago

In the code we do transmute between v4l2_plane__bindgen_ty_1 and v4l2_buffer__bindgen_ty_1, but as has been pointed out to me this is not necessarily safe because they may not be the same size on platforms for which sizeof(c_ulong) != sizeof(*mut).

It would probably be safer to move this into a helper that copies the appropriate member explicitly depending on the memory type of the buffer.