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

Use UINT64_MAX for kComponentTpyeIdInvalid instead of relying on underflow #889

Merged
merged 1 commit into from
Jun 26, 2021

Conversation

adlarkin
Copy link
Contributor

@adlarkin adlarkin commented Jun 26, 2021

Signed-off-by: Ashton Larkin [email protected]

🦟 Bug fix

Summary

kComponentTypeIdInvalid was defined as -1. However, the type for this alias variable is ComponentTypeId, which is uint64_t. So, using -1 results in underflow. While this shouldn't be a problem if we're always using the alias, I've explicitly set the invalid type alias to UINT64_MAX to prevent any weird bugs that may arise from underflow.

Checklist

  • Signed all commits for DCO
  • Added tests
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge

@adlarkin adlarkin requested a review from chapulina June 26, 2021 02:37
@github-actions github-actions bot added the 🏰 citadel Ignition Citadel label Jun 26, 2021
@adlarkin adlarkin changed the title Use UINT64_MAX for kComponentTpyeIDInvalid instead of relying on underflow Use UINT64_MAX for kComponentTpyeIdInvalid instead of relying on underflow Jun 26, 2021
@codecov
Copy link

codecov bot commented Jun 26, 2021

Codecov Report

Merging #889 (81c21bf) into ign-gazebo3 (279e4ff) will increase coverage by 0.04%.
The diff coverage is n/a.

Impacted file tree graph

@@               Coverage Diff               @@
##           ign-gazebo3     #889      +/-   ##
===============================================
+ Coverage        77.90%   77.94%   +0.04%     
===============================================
  Files              215      215              
  Lines            12077    12077              
===============================================
+ Hits              9408     9414       +6     
+ Misses            2669     2663       -6     
Impacted Files Coverage Δ
src/SimulationRunner.cc 94.42% <0.00%> (+1.07%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 279e4ff...81c21bf. Read the comment docs.

Copy link
Contributor

@chapulina chapulina left a comment

Choose a reason for hiding this comment

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

😅

@chapulina chapulina merged commit dd9f7b5 into ign-gazebo3 Jun 26, 2021
@chapulina chapulina deleted the adlarkin/fix_underflow_initialization branch June 26, 2021 04:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏰 citadel Ignition Citadel
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants