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

generator: fix message length table overflow #344

Merged
merged 1 commit into from
Sep 17, 2019

Conversation

julianoes
Copy link
Contributor

Since MAVLink 2 we can have message IDs > 256 and we should probably look up the message length in the mavlink_msg_entry dict instead.

Fixes #145.

@@ -681,11 +676,12 @@ MAVLINK_HELPER uint8_t mavlink_frame_char_buffer(mavlink_message_t* rxmsg,
status->parse_state = MAVLINK_PARSE_STATE_GOT_PAYLOAD;
}
#ifdef MAVLINK_CHECK_MESSAGE_LENGTH
if (rxmsg->len != MAVLINK_MESSAGE_LENGTH(rxmsg->msgid))
if (rxmsg->len < mavlink_min_message_length(rxmsg) ||
rxmsg->len > mavlink_max_message_length(rxmsg))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have a feeling one of these bounds checks is missing a >= or <=

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know 🤔.

@julianoes julianoes force-pushed the fix-check-message-length branch from 3ff976b to bbefc9a Compare August 19, 2019 13:38
@julianoes
Copy link
Contributor Author

@OXINARF do you need any other changes?

@OXINARF
Copy link
Member

OXINARF commented Aug 22, 2019

@julianoes It should be squashed. And my comment regarding the formatting still applies (given we aren't fixing it here, it's better to not make it worse).

Since MAVLink 2 we can have message IDs > 256 and we should probably
look up the message length in the mavlink_msg_entry dict instead.
@julianoes julianoes force-pushed the fix-check-message-length branch from f1ee362 to 4e5107d Compare August 22, 2019 12:40
@julianoes
Copy link
Contributor Author

Ok, I squashed it to one commit and made the case I touched all tabs, and fixed the indenting.

@magicrub
Copy link
Contributor

so... spaces wins?

@julianoes
Copy link
Contributor Author

@magicrub I'm very much in favor of spaces but I'm not a maintainer here, so I don't think it should be up to me. 😄

@magicrub
Copy link
Contributor

I'm on team SPACES

@julianoes
Copy link
Contributor Author

Anything else needed here? As said the tab vs. spaces discussion should not interfere with this bugfix in my opinion.

@julianoes
Copy link
Contributor Author

Bump 🥺.

@tridge
Copy link
Contributor

tridge commented Sep 17, 2019

I'm not too fussed by the whitespace, merging, thanks!

@tridge tridge merged commit 5ec829a into ArduPilot:master Sep 17, 2019
@julianoes julianoes deleted the fix-check-message-length branch September 17, 2019 11:27
julianoes added a commit to mavlink/mavlink that referenced this pull request Sep 17, 2019
hamishwillee pushed a commit to mavlink/mavlink that referenced this pull request Sep 17, 2019
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.

MAVLINK_CHECK_MESSAGE_LENGTH have a bug
4 participants