technocreatives / dbc-codegen

Generate Rust structs for messages from a dbc (CAN bus definition) file.
Apache License 2.0
48 stars 31 forks source link

Handle nonsensical signal min/max bounds #64

Open hulthe opened 9 months ago

hulthe commented 9 months ago
 SG_ ByteWithNegativeMin : 32|8@1+ (1,-2) [-127|127] "" Vector__XXX

^ In this signal, the min bound of -127 is lower than the lowest representable value -2. If one were to pass in a value lower than -2 to the setter function, it would underflow and result in nonsense. check_ranges doesn't help either as it only validates that the value is within -127..=127