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
I can't find an example of it being set to a negative value even though the interface would permit that. And if you did set it to a negative value it would cause all these operator[] calls that use it to access memory from before the array.
Would it hurt anything if I made it an unsigned value and initialized it to 0? Am I misunderstanding something about the interface here? Is there an implicit contract that this value will be initialized (correctly) before it is used and is therefore safe?
The text was updated successfully, but these errors were encountered:
Description
Why is the joint_index_ in JointModel a signed integer?
Here is where you get it: https://github.com/ros-planning/moveit2/blob/52ffbfdbd4ffee3267371ab8d43d14a30082f547/moveit_core/robot_model/include/moveit/robot_model/joint_model.h#L215
Here is one of many examples of it being used to index into an array: https://github.com/ros-planning/moveit2/blob/52ffbfdbd4ffee3267371ab8d43d14a30082f547/moveit_core/robot_model/src/robot_model.cpp#L184
I can't find an example of it being set to a negative value even though the interface would permit that. And if you did set it to a negative value it would cause all these operator[] calls that use it to access memory from before the array.
It is initialized to -1 here: https://github.com/ros-planning/moveit2/blob/52ffbfdbd4ffee3267371ab8d43d14a30082f547/moveit_core/robot_model/src/joint_model.cpp#L58
Would it hurt anything if I made it an unsigned value and initialized it to 0? Am I misunderstanding something about the interface here? Is there an implicit contract that this value will be initialized (correctly) before it is used and is therefore safe?
The text was updated successfully, but these errors were encountered: