You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
MAVLink STATUSTEXT chunking mishandles ID zero and exact 50-byte boundaries #29251
The PX4 MAVLink STATUSTEXT sender can produce chunked messages that do not follow the MAVLink STATUSTEXT chunking contract. The relevant code is src/modules/mavlink/streams/STATUSTEXT.hpp.
The MAVLink definition says id == 0 means the message is a single chunk, and a NUL anywhere in the 50-byte text field marks the last chunk.
Problems
The first status text uses ID zero._id is initialized to zero, and the sender assigns msg.id = _id++. If the first published status text is longer than 50 bytes, every chunk has ID zero. A receiver following the spec therefore treats each chunk as an independent message rather than assembling them. The same issue recurs when the 16-bit ID wraps to zero.
An exact multiple of 50 bytes has no terminating chunk. The sender copies full 50-byte chunks. When the final remainder is exactly 50 bytes, it sends that full chunk and breaks because text_size <= max_chunk_size; it does not send a following NUL-terminated chunk. Receivers cannot tell that the sequence is complete and may eventually time out or report a missing chunk. For example, a 100-byte message is sent as chunks 0 and 1, both full-width, with no NUL in either chunk.
Expected behavior
Chunked messages use a nonzero id for every chunk, including across ID wraparound.
The final chunk contains a NUL in the text field. For a message whose length is an exact multiple of 50 bytes, send an empty NUL-terminated chunk after the full chunks (or otherwise ensure the last transmitted chunk contains a NUL without dropping message bytes).
How to reproduce
Exercise the STATUSTEXT sender with a message longer than 50 bytes as the first status text, and with text lengths of exactly 50, 100, or 150 bytes. Inspect id, chunk_seq, and the raw 50-byte text field in the transmitted packets.
I checked this against the MAVLink STATUSTEXT definition in the PX4 tree and the local PX4 sender implementation.
Activity