Skip to content

Commit

Permalink
CollisionPrevention: prevent illegal array index with malicious obsta…
Browse files Browse the repository at this point in the history
…cle_dsitance message
  • Loading branch information
MaEtUgR authored and Claudio-Chies committed Nov 21, 2024
1 parent 1410325 commit bbc59dc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/lib/collision_prevention/CollisionPrevention.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ void CollisionPrevention::_addObstacleSensorData(const obstacle_distance_s &obst
// Obstacle message arrives in local_origin frame (north aligned)
// corresponding data index (convert to world frame and shift by msg offset)
for (int i = 0; i < BIN_COUNT; i++) {
for (int j = 0; j < 360 / obstacle.increment; j++) {
for (int j = 0; (j < 360 / obstacle.increment) && (j < BIN_COUNT); j++) {
float bin_lower_angle = _wrap_360((float)i * _obstacle_map_body_frame.increment + _obstacle_map_body_frame.angle_offset
- (float)_obstacle_map_body_frame.increment / 2.f);
float bin_upper_angle = _wrap_360((float)i * _obstacle_map_body_frame.increment + _obstacle_map_body_frame.angle_offset
Expand Down

0 comments on commit bbc59dc

Please sign in to comment.