Missing bounds check for collision object subframe names
Maintainers usually reply within 1 day
@huxiaoyi-ovo is already working on this.
Since Oct 30, 2026.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
Research direction
Read the two affected loops in moveit_core/planning_scene/src/planning_scene.cpp at the cited locations, then compare their validation with the check in moveit_core/robot_state/src/conversions.cpp around line 271. Add coverage for malformed subframe arrays in both PlanningScene paths; the issue suggests running the cases with AddressSanitizer or bounds checking. Done means both paths reject mismatched arrays without modifying the planning scene.
Written by the indexing model from the issue text.
Description
Description
Two code paths in moveit_core/planning_scene/src/planning_scene.cpp iterate over subframe_poses.size() and access subframe_names[I] without checking whether the two vectors have equal lengths.
The affected locations are:
- Lines 1616–1620: attached collision object processing.
- Lines 1925–1933: collision object ADD processing.
The relevant code is:
for (std::size_t i = 0; i < object.subframe_poses.size(); ++i)
{
utilities::poseMsgToEigen(object.subframe_poses[i], subframe_pose);
std::string name = object.subframe_names[i];
subframes[name] = subframe_pose;
}
When subframe_poses.size() > subframe_names.size(), the access to subframe_names[i] is out of bounds, resulting in undefined behavior.
A similar code path in moveit_core/robot_state/src/conversions.cpp (around line 271) already performs an explicit size consistency check:
if (aco.object.subframe_poses.size() != aco.object.subframe_names.size())
{
RCLCPP_ERROR(...);
return;
}
The corresponding validation appears to be missing from the two PlanningScene code paths.
Suggested fix: Validate the lengths of subframe_poses and subframe_names before accessing either vector, and reject malformed messages without modifying the planning scene.
This issue is based on source-code inspection. Runtime reproduction is pending.
ROS Distro
Humble
OS and version
Ubuntu 22.04
Source or binary build?
Source
If binary, which release version?
No response
If source, which branch?
No response
Which RMW are you using?
None
Steps to Reproduce
Proposed reproduction steps :
- Create a moveit_msgs::msg::CollisionObject containing valid collision geometry.
- Add one valid pose to subframe_poses.
- Leave subframe_names empty.
- Submit the message through the PlanningScene collision object ADD processing path.
- Run the test with AddressSanitizer or a bounds-checking STL configuration to detect the potential out-of-bounds access.
The attached collision object path should be tested separately with the same mismatched subframe arrays.
Expected behavior
The operation should reject inconsistent subframe arrays and report an error without accessing memory outside the vector.
Actual behavior
Source inspection shows that the loop indexes subframe_names[i] without validating the vector length.This behavior may result in an out-of-bounds access. Runtime reproduction is still pending.
Backtrace or Console output
No response
- Dominant language
- C++
- Stars
- 2.1k
- Forks
- 816
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 4
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from moveit/moveit2
-
Failed collision object ADD replacement removes the existing object before validationPossibly taken @paneendrakumar0 claimed this 9 days ago. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
moveit/moveit2#3942 · 2 comments ·
Maintainers usually reply within 1 day
-
Collision object MOVE modifies object pose before validating shape pose countMay be free again A pull request for this issue was closed without being merged. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
moveit/moveit2#3941 · 2 comments ·
Maintainers usually reply within 1 day
-
Missing copy-on-write protection in World::moveShapesInObject and setSubframesOfObjectMay be free again A pull request for this issue was closed without being merged. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
moveit/moveit2#3940 · 2 comments ·
Maintainers usually reply within 1 day
-
std::max mixes translational (m) and rotational (rad) errors in kdl_kinematics_plugin.cppMay be free again @Rudyy75 claimed this 138 days ago, and no pull request is open. Openbug
Difficulty 2/5 1-3 hours Newbie friendliness 63/100
moveit/moveit2#3747 · 2 comments ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
new issue
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
llvm/llvm-project#240065 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 2 days
-
ai_p2
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
ClickHouse/ClickHouse#130006 ·
Maintainers usually reply within 1 day
-
RebuildGeom rebuilds vertex buffers needlesslyPossibly taken @trish-sl claimed this today. Opentriage
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
secondlife/viewer#6653 ·
Maintainers usually reply within 1 day