a1ien / rusb

A safe Rust wrapper for libusb.
Other
382 stars 78 forks source link

Replace .get_unchecked_mut() with .as_mut_ptr().add() when accessing iso_packet_desc (fixes #199) #200

Closed alufers closed 3 months ago

alufers commented 3 months ago

This prevents panics on debug builds in new rust nightly versions (as of 2024-03-27), since they added bounds checks to get_unchecked_mut, which here was called on a zero-length slice representing a flexible array member. See: https://github.com/rust-lang/rust/commit/2b43e75c98cc5ae32328c8b49657bcd882eb5e75

TBH I am still learning rust, so if there is any better way of doing this let me know and I will change it.

a1ien commented 3 months ago

Looks good to me

a1ien commented 3 months ago

Merged. Thanks.