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

Bad checksum messages ending with MAVLINK_STX causing parser get out of sync #881

Open
tomerg-flytrex opened this issue Nov 30, 2023 · 0 comments · May be fixed by #897
Open

Bad checksum messages ending with MAVLINK_STX causing parser get out of sync #881

tomerg-flytrex opened this issue Nov 30, 2023 · 0 comments · May be fixed by #897

Comments

@tomerg-flytrex
Copy link

I found an issue where if the c parser gets a message that does not pass the checksum check, and the second checksum byte is MAVLINK_STX the parser will get out of sync and won't be able to parse the next message, possibly more than that depending on their content.
The issue is with the mavlink_parse_char function in mavlink_helpers.h. The code there checks if the second checksum byte is MAVLINK_STX and if it is then it counts it as the start of the next message. I stumbled this issue when testing out the PingRx ADS-B with ArduCopter, which for some reason sends messages not defined in the uAvionix xml. This caused the parser to fail parsing them due to the crc_extra being wrong, which in turn sometimes leads to 20 seconds without successfully parsed messages. Obviously adding the missing messages to the xml could solve it in this case but I don't see the reason behind this check:

	    if (c == MAVLINK_STX)
	    {
		    status->parse_state = MAVLINK_PARSE_STATE_GOT_STX;
		    rxmsg->len = 0;
		    mavlink_start_checksum(rxmsg);
	    }
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 a pull request may close this issue.

1 participant