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

Bugfix: Guess ROS msgs types within package before selecting external to package type #922

Conversation

rugged-robotics
Copy link
Contributor

@rugged-robotics rugged-robotics commented Jan 22, 2024

In some scenarios for msg types defined with fields of types with the same type name as types that exist in other packages, the type will be resolved to a package which is not that of the root type containing the field. As an example:

motion_msgs/Motion defined as:

uint8 type
float64 start_time
float64 duration
Point start_point
Point end_point

etc..

The Point in this type is part of our motion_msgs package and thus is referred to without a package name. When being deserialized it current is resolved to geometry_msgs/Point instead of motion_msgs/Point, resulting in a size mismatch and overrun further into deserializing the msg.

The change in the PR would check for the existence of a Point type with the same package as motion_msgs/Motion, matching motion_msgs/Point first instead of geometry_msgs, before matching a type outside the root type's package.

This appears to have been introduced in the latest ROS refactor somehow as we haven't had any issues loading bag files with this type in the past.

Attached bag showing a buffer overrun in the deserialization due to using geometry_msgs/Point instead of the custom defined motion_msgs/Point when deserializing the motion_msgs/Motion type. Bag contains exactly one of the offending msg.

plotjuggler_test_case.zip

@rugged-robotics rugged-robotics force-pushed the fix_ambiguous_ros_type_resolution branch from 7c83eb1 to fa9c46d Compare January 24, 2024 16:46
@rugged-robotics
Copy link
Contributor Author

branch re-based onto latest main post release

@rugged-robotics rugged-robotics force-pushed the fix_ambiguous_ros_type_resolution branch from fa9c46d to fc7982b Compare January 24, 2024 17:06
@facontidavide facontidavide merged commit 3be95bb into facontidavide:main Jan 25, 2024
1 check passed
@facontidavide
Copy link
Owner

looks good. Thanks!

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.

2 participants