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

p2p/discv5: make idx bounds checking more sound #17571

Merged
merged 1 commit into from Sep 3, 2018
Merged

Conversation

@HAOYUatHZ
Copy link
Contributor

HAOYUatHZ commented Sep 3, 2018

in golang, for convenience, return type of len() is int instead of uint,so that we don't need to code like len(array) >= uint(bound),

however, the value of len() cannot be negative.

there's a previous fix #17274, because converting idx to int can bypass the check if idx overflows int.

I believe my change will make the checking logic more sound.

@HAOYUatHZ HAOYUatHZ requested review from fjl and zsfelfoldi as code owners Sep 3, 2018
@fjl
fjl approved these changes Sep 3, 2018
Copy link
Contributor

fjl left a comment

Thank you :)

@fjl fjl merged commit 5c0954a into ethereum:master Sep 3, 2018
1 of 3 checks passed
1 of 3 checks passed
continuous-integration/appveyor/pr AppVeyor build failed
Details
continuous-integration/travis-ci/pr The Travis CI build failed
Details
commit-message-check/gitcop All commit messages are valid
Details
@karalabe karalabe added this to the 1.8.16 milestone Sep 10, 2018
cryptomental pushed a commit to cryptomental/go-ethereum that referenced this pull request Jan 9, 2019
cryptomental added a commit to cryptomental/go-ethereum that referenced this pull request Jan 9, 2019
cryptomental added a commit to cryptomental/go-ethereum that referenced this pull request Jan 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.