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

Fix decoding of compound TAO elements #25

Merged
merged 1 commit into from
Jul 16, 2024

Conversation

tpwrules
Copy link
Contributor

Previously, if any bits were left, the loop would try to decode another element. However, elements of arrays eligible for TAO must be >= 8 bits, so the decode would over-run by an element if 7 or fewer bits were left and the decode would fail due to the length check.

Fix this by only decoding until there are 7 or fewer bits left.

Not triggered by any message in the DSDL repo, but it is easy to create one which would be incorrectly decoded, e.g.

void1 pad
uavcan.equipment.gnss.Fix2 fix

Previously, if any bits were left, the loop would try to decode another
element. However, elements of arrays eligible for TAO must be >= 8 bits,
so the decode would over-run by an element if 7 or fewer bits were left
and the decode would fail due to the length check.

Fix this by only decoding until there are 7 or fewer bits left.

Not triggered by any message in the DSDL repo, but it is easy to create
one which would be incorrectly decoded, e.g.

```
void1 pad
uavcan.equipment.gnss.Fix2 fix
```
@tridge tridge merged commit 53b02ce into dronecan:master Jul 16, 2024
3 checks passed
@tpwrules tpwrules deleted the pr/fix-compound-tao branch July 16, 2024 02:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants