Skip to content

Commit 51c7ffc

Browse files
fix(autoware_lidar_marker_localization): fix segmentation fault (#8943)
* fix segmentation fault Signed-off-by: Yamato Ando <yamato.ando@tier4.jp> * style(pre-commit): autofix --------- Signed-off-by: Yamato Ando <yamato.ando@tier4.jp> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent ae436b3 commit 51c7ffc

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

localization/autoware_landmark_based_localizer/autoware_lidar_marker_localizer/src/lidar_marker_localizer.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,12 @@ std::vector<landmark_manager::Landmark> LidarMarkerLocalizer::detect_landmarks(
362362
// Check that the leaf size is not too small, given the size of the data
363363
const int bin_num = static_cast<int>((max_x - min_x) / param_.resolution + 1);
364364

365+
if (bin_num < static_cast<int>(param_.intensity_pattern.size())) {
366+
RCLCPP_WARN_STREAM_THROTTLE(
367+
this->get_logger(), *this->get_clock(), 1000, "bin_num is too small!");
368+
return std::vector<landmark_manager::Landmark>{};
369+
}
370+
365371
// initialize variables
366372
std::vector<int> vote(bin_num, 0);
367373
std::vector<float> min_y(bin_num, std::numeric_limits<float>::max());

0 commit comments

Comments
 (0)