Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(compare_map_segmentation): fix process died for invalid access #4676

Conversation

1222-takeshi
Copy link
Contributor

@1222-takeshi 1222-takeshi commented Aug 21, 2023

Description

🤖 Generated by Copilot at f811784

Fix a potential bug in compare_map_segmentation that could cause out-of-bounds access to a vector. Add a validity check for the index variable in voxel_grid_map_loader.hpp.

[component_container_mt-10] terminate called after throwing an instance of 'std::out_of_range'
[component_container_mt-10]   what():  vector::_M_range_check: __n (which is 18446744073709551615) >= this->size() (which is 320)

image

Related links

Tests performed

Notes for reviewers

Interface changes

Effects on system behavior

Pre-review checklist for the PR author

The PR author must check the checkboxes below when creating the PR.

In-review checklist for the PR reviewers

The PR reviewers must check the checkboxes below before approval.

  • The PR follows the pull request guidelines.
  • The PR has been properly tested.
  • The PR has been reviewed by the code owners.

Post-review checklist for the PR author

The PR author must check the checkboxes below before merging.

  • There are no open discussions or they are tracked via tickets.
  • The PR is ready for merge.

After all checkboxes are checked, anyone who has write access can merge the PR.

Summary by CodeRabbit

Release Notes:

  • Bug fix: Added a validity check for the index variable in the VoxelGridDynamicMapLoader class to prevent updating the array with an invalid index.

"A bug was found, a fix was made,
Ensuring validity, no more charade.
With checks in place, errors evade,
Smooth sailing ahead, on this code cascade."

@github-actions github-actions bot added the component:perception Advanced sensor data processing and environment understanding. (auto-assigned) label Aug 21, 2023
Signed-off-by: 1222-takeshi <[email protected]>
@yukkysaito yukkysaito added tag:run-build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci) openai-pr-reviewer labels Aug 21, 2023
@github-actions
Copy link

github-actions bot commented Aug 21, 2023

Image description CodeRabbit

Walkthrough

The overall change introduces a validity check for the index variable in the VoxelGridDynamicMapLoader class. Previously, if index was greater than or equal to the product of map_grids_x_ and map_grids_y_, the loop would continue without updating the current_voxel_grid_array_. The change adds an additional condition to check if index is less than 0, indicating an invalid index. If either condition is true, the loop will continue without updating the array.

Changes

File Summary
perception/compare_map_segmentation/include/compare_map_segmentation/voxel_grid_map_loader.hpp The diff introduces a validity check for the index variable in the VoxelGridDynamicMapLoader class. Previously, if index was greater than or equal to the product of map_grids_x_ and map_grids_y_, the loop would continue without updating the current_voxel_grid_array_. The change adds an additional condition to check if index is less than 0, indicating an invalid index. If either condition is true, the loop will continue without updating the array.

Uplevel your code reviews with CodeRabbit Pro

CodeRabbit Pro

If you like this project, please support us by purchasing the Pro version. The Pro version has advanced context, superior noise reduction and several proprietary improvements compared to the open source version.

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Image description CodeRabbit

Commits Files that changed from the base of the PR and between 1f8ac87 and f17110c commits.
Files selected (1)
  • perception/compare_map_segmentation/include/compare_map_segmentation/voxel_grid_map_loader.hpp (1)
Review comments generated (1)
  • Review: 1
  • LGTM: 0

Tips

Chat with Image description CodeRabbit Bot (@coderabbitai)

  • Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
  • Invite the bot into a review comment chain by tagging @coderabbitai in a reply.

Code suggestions

  • The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
  • You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.

Pausing incremental reviews

  • Add @coderabbitai: ignore anywhere in the PR description to pause further reviews from the bot.

Signed-off-by: 1222-takeshi <[email protected]>
@codecov
Copy link

codecov bot commented Aug 21, 2023

Codecov Report

Patch and project coverage have no change.

Comparison is base (338d4b0) 14.89% compared to head (e8ea750) 14.89%.
Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4676   +/-   ##
=======================================
  Coverage   14.89%   14.89%           
=======================================
  Files        1549     1549           
  Lines      106946   106944    -2     
  Branches    32784    32782    -2     
=======================================
  Hits        15926    15926           
+ Misses      73627    73625    -2     
  Partials    17393    17393           
Flag Coverage Δ *Carryforward flag
differential 0.00% <0.00%> (?)
total 14.89% <ø> (+<0.01%) ⬆️ Carriedforward from 338d4b0

*This pull request uses carry forward flags. Click here to find out more.

Files Changed Coverage Δ
...c/lanelet2_map_loader/lanelet2_map_loader_node.cpp 9.61% <ø> (+0.35%) ⬆️
...compare_map_segmentation/voxel_grid_map_loader.hpp 0.00% <0.00%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@badai-nguyen badai-nguyen left a comment

Choose a reason for hiding this comment

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

@1222-takeshi thank you for your PR. It LGTM. I will check the reason why index is potential to become negative and fix it soon.

@1222-takeshi 1222-takeshi merged commit 4297f3d into autowarefoundation:main Aug 21, 2023
27 of 29 checks passed
@1222-takeshi 1222-takeshi deleted the fix/fix-process-died-for-invalid-access branch August 21, 2023 02:36
1222-takeshi added a commit to tier4/autoware.universe that referenced this pull request Aug 21, 2023
…utowarefoundation#4676)

* fix(compare_map_segmentation): fix process died for invalid access

Signed-off-by: 1222-takeshi <[email protected]>

* style(pre-commit): autofix

* fix: missing username in TODO

Signed-off-by: 1222-takeshi <[email protected]>

* fix: change condition

Signed-off-by: 1222-takeshi <[email protected]>

* fix

Signed-off-by: 1222-takeshi <[email protected]>

---------

Signed-off-by: 1222-takeshi <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
tkimura4 pushed a commit to tier4/autoware.universe that referenced this pull request Aug 21, 2023
…towarefoundation#4676 (#753)

fix(compare_map_segmentation): fix process died for invalid access (autowarefoundation#4676)

* fix(compare_map_segmentation): fix process died for invalid access



* style(pre-commit): autofix

* fix: missing username in TODO



* fix: change condition



* fix



---------

Signed-off-by: 1222-takeshi <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component:perception Advanced sensor data processing and environment understanding. (auto-assigned) tag:run-build-and-test-differential Mark to enable build-and-test-differential workflow. (used-by-ci)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants