Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

validate received union tag #29

Merged
merged 1 commit into from
Jul 21, 2024

Conversation

tpwrules
Copy link
Contributor

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
Copy link
Contributor Author

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.

templates/msg.h.em Outdated Show resolved Hide resolved
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 tpwrules force-pushed the pr/validate-union-tag branch from b6d5905 to 24b31ec Compare July 21, 2024 04:54
@tridge tridge merged commit 43d8a9e into dronecan:master Jul 21, 2024
3 checks passed
@tpwrules tpwrules deleted the pr/validate-union-tag branch July 21, 2024 04:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants