Skip to content

Conversation

@mileticveljko
Copy link
Contributor

This PR fixes a segmentation fault occurring in mavlink_finalize_message_buffer function. The crash was caused by the compiler implicitly declaring mavlink_get_channel_status as returning a 32-bit int instead of a 64-bit pointer.

When mavlink_helpers.h attempted to resolve the channel status via the MAVLINK_GET_CHANNEL_STATUS macro, it received a truncated address. On 64-bit systems, this resulted in a garbage pointer (e.g., 0x555594e0 instead of 0x5555555594e0), leading to a memory access violation when dereferencing status->flags.

This used to work on systems where the size of the pointer type is equal to the size of the int type, and it wasn't caught by the compiler because the MAVLink headers are marked as SYSTEM_PUBLIC in CMakeLists.txt.

Copy link
Member

@DNedic DNedic left a comment

Choose a reason for hiding this comment

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

LGTM, nice find!

@mileticveljko mileticveljko force-pushed the fix/mavlink_bug_implicit_declarations branch from 0e37b94 to 25862aa Compare January 9, 2026 22:30
@mileticveljko mileticveljko merged commit fddc7ab into master Jan 9, 2026
3 checks passed
@mileticveljko mileticveljko deleted the fix/mavlink_bug_implicit_declarations branch January 9, 2026 22:35
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.

4 participants