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

unknownproto: check result from protowire.ConsumeFieldValue and return an error #7770

Merged

Conversation

odeke-em
Copy link
Collaborator

@odeke-em odeke-em commented Nov 1, 2020

Given that protowire.ConsumeFieldValue returns -1 when it encounters an
error, perform a check for n < 0 and return the respectively obtained
error with context about the details.

Fixes an issue identified from a go-fuzz session, thanks to Ethan
Buchman and the IBC auditors from Informal Systems et al.

Fixes #7739.


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • 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
  • Review Codecov Report in the comment section below once CI passes

…n error

Given that protowire.ConsumeFieldValue returns -1 when it encounters an
error, perform a check for n < 0 and return the respectively obtained
error with context about the details.

Fixes an issue identified from a go-fuzz session, thanks to Ethan
Buchman and the IBC auditors from Informal Systems et al.

Fixes #7739.
@odeke-em odeke-em force-pushed the unknownproto-catch-errors-from-protowire.ConsumeFieldValue branch from b247fca to b915e8d Compare November 1, 2020 06:15
@codecov
Copy link

codecov bot commented Nov 1, 2020

Codecov Report

Merging #7770 (018f3da) into master (55772ae) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master    #7770   +/-   ##
=======================================
  Coverage   54.19%   54.20%           
=======================================
  Files         610      610           
  Lines       38811    38815    +4     
=======================================
+ Hits        21035    21039    +4     
  Misses      15621    15621           
  Partials     2155     2155           

codec/unknownproto/unknown_fields.go Outdated Show resolved Hide resolved
@odeke-em odeke-em requested a review from alexanderbez November 1, 2020 21:34
@odeke-em odeke-em force-pushed the unknownproto-catch-errors-from-protowire.ConsumeFieldValue branch from 1af0c86 to 4499515 Compare November 1, 2020 21:42
Copy link
Collaborator

@robert-zaremba robert-zaremba left a comment

Choose a reason for hiding this comment

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

lgtm

codec/unknownproto/regression_test.go Outdated Show resolved Hide resolved
codec/unknownproto/regression_test.go Outdated Show resolved Hide resolved
@odeke-em odeke-em requested a review from amaury1093 November 4, 2020 21:58
codec/unknownproto/regression_test.go Outdated Show resolved Hide resolved
@odeke-em
Copy link
Collaborator Author

odeke-em commented Nov 6, 2020

All done, thanks for the reviews @robert-zaremba @amaurymartiny, addressed! Please help me with the final review/merge. Thank you!

@robert-zaremba robert-zaremba added the A:automerge Automatically merge PR once all prerequisites pass. label Nov 6, 2020
@odeke-em
Copy link
Collaborator Author

odeke-em commented Nov 7, 2020

@alexanderbez could you please take a look? Robert approved and added the automerge label but it perhaps needs another code owner to approve. Thank you!

@mergify mergify bot merged commit fe8a891 into master Nov 9, 2020
@mergify mergify bot deleted the unknownproto-catch-errors-from-protowire.ConsumeFieldValue branch November 9, 2020 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A:automerge Automatically merge PR once all prerequisites pass. C:Encoding
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TxDecoder panics on bad input
5 participants