Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix bug heap-buffer-overflow
Signed-off-by: suifengersan123 <yangabc810@gmail.com>
  • Loading branch information
suifengersan123 committed Nov 28, 2025
commit 8033d3fe0d140bb7dfc0eae6c21ced38bf344986
8 changes: 6 additions & 2 deletions nav2_costmap_2d/src/costmap_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -350,11 +350,15 @@ bool Costmap2D::setConvexPolygonCost(
convexFillCells(map_polygon, polygon_cells);

// set the cost of those cells
bool cells_written = false;
for (unsigned int i = 0; i < polygon_cells.size(); ++i) {
unsigned int index = getIndex(polygon_cells[i].x, polygon_cells[i].y);
costmap_[index] = cost_value;
if (index < size_x_ * size_y_) {
costmap_[index] = cost_value;
cells_written = true;
}
}
return true;
return cells_written;
}

void Costmap2D::polygonOutlineCells(
Expand Down