-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
I-unsound 💥A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessA soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness
Milestone
Description
Rust enums become UB if they hold an unexpected value, while C enums are effectively a grouped list of named constants. This causes easy UB if e.g. C adds a value or returns a value not represented by the enum (as is allowed in C), and this value gets passed to Rust.
The easiest thing to do is map enums to constants, which we already do in most cases. We could also consider an enum!
macro that figures out the values.
Some more context is at https://mdaverde.com/posts/rust-bindgen-enum/ and rust-lang/rust-bindgen#2646.
pronebird
Metadata
Metadata
Assignees
Labels
I-unsound 💥A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessA soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/Soundness