restrction of resolution, throttle_scans and scan_buffer params to avoid illegal access of memory. #542
Merged
Merged
Conversation
SteveMacenski
approved these changes
Oct 31, 2022
SteveMacenski
pushed a commit
that referenced
this pull request
Nov 8, 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(), |
Owner
There was a problem hiding this comment.
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(), |
Owner
There was a problem hiding this comment.
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Basic Info
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.