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 nil pointer deref in distribution tax/rewward validation helpers #5620

Merged
merged 7 commits into from
Feb 7, 2020

Conversation

alessio
Copy link
Contributor

@alessio alessio commented Feb 6, 2020

Before checking Dec's value, one has to ensure the internal big.Int
pointer is not nil first.

Closes: #5621


For contributor use:

  • Targeted PR against correct branch (see CONTRIBUTING.md)
  • Linked to Github issue with discussion and accepted design OR link to spec that describes this work.
  • Code follows the module structure standards.
  • Wrote unit and integration tests
  • Updated relevant documentation (docs/) or specification (x/<module>/spec/)
  • Added relevant godoc comments.
  • Added a relevant changelog entry to the Unreleased section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer

For admin use:

  • Added appropriate labels to PR (ex. WIP, R4R, docs, etc)
  • Reviewers assigned
  • Squashed all commits, uses message "Merge pull request #XYZ: [title]" (coding standards)

@alessio alessio force-pushed the alessio/distr-fix-decimals-validation branch from dce0d0a to a9e9af7 Compare February 6, 2020 17:17
@alessio alessio marked this pull request as ready for review February 6, 2020 17:17
Copy link
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

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

Can you allude to when an Int or Dec would be Nil? This should never be the case.

@alexanderbez
Copy link
Contributor

Please reference the issue in the PR body @alessio

Copy link
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

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

ACK

Before checking Dec's value, one has to ensure the internal big.Int
pointer is not nil first.

Closes: #5621
@alessio alessio force-pushed the alessio/distr-fix-decimals-validation branch from bb967ad to 4d69262 Compare February 7, 2020 06:58
@alessio
Copy link
Contributor Author

alessio commented Feb 7, 2020

@alexanderbez @jackzampolin please have another look

Copy link
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

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

@alessio please address the scope linting errors in the tests.

Co-Authored-By: Bot from GolangCI <42910462+golangcibot@users.noreply.github.com>
Copy link
Contributor

@alexanderbez alexanderbez left a comment

Choose a reason for hiding this comment

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

ACK

@alexanderbez alexanderbez merged commit 6cbf634 into master Feb 7, 2020
@alexanderbez alexanderbez deleted the alessio/distr-fix-decimals-validation branch February 7, 2020 18:09
@codecov
Copy link

codecov bot commented Feb 7, 2020

Codecov Report

Merging #5620 into master will increase coverage by <.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #5620      +/-   ##
==========================================
+ Coverage   44.63%   44.64%   +<.01%     
==========================================
  Files         324      324              
  Lines       24707    24707              
==========================================
+ Hits        11029    11031       +2     
+ Misses      12618    12616       -2     
  Partials     1060     1060
Impacted Files Coverage Δ
x/mock/app.go 66.46% <0%> (+1.21%) ⬆️

@alessio alessio mentioned this pull request Mar 20, 2020
13 tasks
alexanderbez pushed a commit that referenced this pull request Mar 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Potential nil pointer dereference in x/distribution
4 participants