dronecan / dronecan_dsdlc

Other
6 stars 29 forks source link

validate received union tag #29

Closed tpwrules closed 1 month ago

tpwrules commented 1 month ago

Avoids setting a non-existent union value and causing undefined behavior.

Additionally be sure bit_ofs is updated after decoding the tag before the error is raised. This matches all other uses of canardDecodeScalar.

tpwrules commented 1 month ago

Tested that this branch works well with the quadplane-can simulated vehicle on ArduPilot master (9c1fe4e1). It flies and all the sensors work properly. Also tested that the DroneCAN GUI tool works properly as that seems to be the biggest user of unions.