Skip to content

restrction of resolution, throttle_scans and scan_buffer params to avoid illegal access of memory. #542

Merged
SteveMacenski merged 1 commit into
SteveMacenski:ros2from
Cryst4L9527:ros2
Oct 31, 2022
Merged

restrction of resolution, throttle_scans and scan_buffer params to avoid illegal access of memory. #542
SteveMacenski merged 1 commit into
SteveMacenski:ros2from
Cryst4L9527:ros2

Conversation

@Cryst4L9527
Copy link
Copy Markdown
Contributor


Basic Info

Info Please fill out this column
Ticket(s) this addresses
Primary OS tested on Ubuntu
Robotic platform tested on gazebo simulation of turtlebot

Description of contribution in a few bullet points

resolution: if resolution < 0, when updateMap(), OccupancyGrid will have a negative width and height, which will cause overflow when processMap() since the access of new_map.data gets an index over range.

throttle_scans: must not be zero, or when scan_ctr % throttle_scans, there will be a %0 operation and lead to a mistake.

scan_buffer params: scan_buffer_size should >0 and scan_buffer_maximum_scan_distance should have a absolute value > 1e-03.
Because in AddRunningScan(), there is a operation removing all the scans when a value is larger than square(scan_buffer_maximum_scan_distance)-1e6 or the number of rest scans is larger than scan_buffer_size. If not restrict the input params, this operation will remove all the scans and still visit the scan vectors, leading to illegal access of memory.

Description of documentation updates required from your changes

I checks all the restrictions when Param settings, if check is failed, the values are set to be default values and a warning is thrown, just like some other parameters check before.


Future work that may be required in bullet points

Maybe more check for the empty vector and negative width/height.

@SteveMacenski SteveMacenski merged commit 80503c2 into SteveMacenski:ros2 Oct 31, 2022
SteveMacenski added a commit that referenced this pull request Nov 8, 2022
* Fixed constraint between first scans for multilaser systems (#539)

* restrction of resolution, throttle_scans and scan_buffer params (#542)

* bumping 2.6.2 for Humble release

Co-authored-by: jsongCMU <89307447+jsongCMU@users.noreply.github.com>
Co-authored-by: Hao-Xuan Song <44140526+Cryst4L9527@users.noreply.github.com>
resolution_ = this->declare_parameter("resolution", resolution_);

if (resolution_ <= 0.0) {
RCLCPP_WARN(node->get_logger(),
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please compile the code first before submitting PRs, this does not compile.

throttle_scans_ = this->declare_parameter("throttle_scans", throttle_scans_);

if (throttle_scans_ == 0) {
RCLCPP_WARN(node->get_logger(),
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please compile the code first before submitting PRs, this does not compile.

SteveMacenski added a commit that referenced this pull request Nov 9, 2022
SteveMacenski added a commit that referenced this pull request Nov 9, 2022
SteveMacenski added a commit that referenced this pull request Nov 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants