Skip to content

Commit

Permalink
Use worldToMapEnforceBounds in clear_costmap_service (#2544)
Browse files Browse the repository at this point in the history
to avoid buffer overflow

Signed-off-by: zouyonghao <[email protected]>
  • Loading branch information
zouyonghao authored and SteveMacenski committed Sep 14, 2021
1 parent b6194b2 commit d9983a5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions nav2_costmap_2d/src/clear_costmap_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,8 @@ void ClearCostmapService::clearLayerRegion(
double end_point_y = start_point_y + reset_distance;

int start_x, start_y, end_x, end_y;
costmap->worldToMapNoBounds(start_point_x, start_point_y, start_x, start_y);
costmap->worldToMapNoBounds(end_point_x, end_point_y, end_x, end_y);
costmap->worldToMapEnforceBounds(start_point_x, start_point_y, start_x, start_y);
costmap->worldToMapEnforceBounds(end_point_x, end_point_y, end_x, end_y);

costmap->clearArea(start_x, start_y, end_x, end_y, invert);

Expand Down

0 comments on commit d9983a5

Please sign in to comment.