ArduPilot / ArduPilot/pymavlink

message CRC checksum is wrong when a mavlink_message_t is converted to a sending buffer

Open
#237 26 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
730
Forks
741
Avg merge
4d 10h
Merged PRs (30d)
7

Description

issue: we may receive valid mavlink2 messages that contains "0" bytes
in the message payload which are not generated by this library.
for such a messages, we can succussfully convert it to a
mavlink_message_t. we may decide to forward it to its next stop.
when "mavlink_msg_to_send_buffer()" is called to convert the
mavlink_message_t to another sending buffer, the "0"s in the
playload are trimmed, but the message crc checksum is not updated
accordingly. as a result, on the next receiving end, the buffer
can no longer be assembled back to a mavlink_message_t.
cause: the message crc checksum doesn't match the payload content.
fix: recaculate the crc checksum if message payload is changed.

patch is attached.
[recalculate_crc_if_payload_changes.zip](https://github.com/ArduPilot/pymavlink/files/2556487/recalculate_crc_if_payload_changes.zip)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by locating mavlink_msg_to_send_buffer() and inspect how zero bytes are trimmed and how the existing message CRC is carried into the sending buffer. Reproduce the issue with a valid MAVLink2 message containing zero bytes in its payload, then verify that the recalculated CRC matches the trimmed payload and that the buffer can be parsed back into a mavlink_message_t.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.