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 overflow-related out-of-bounds panic in decodeBytes() #347

Merged
merged 7 commits into from
Dec 14, 2020

Conversation

erikgrinaker
Copy link
Contributor

@erikgrinaker erikgrinaker commented Dec 13, 2020

Fixes #339, again -- the previous fix had another overflow issue causing out of bounds errors. 🤦‍♂️ See issue for details.

Would appreciate thorough reviews to make sure this is solid.

Copy link
Contributor

@odeke-em odeke-em left a comment

Choose a reason for hiding this comment

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

Thank you @erikgrinaker!
The end < n + s >= maxInt || size < 0 checks effectively curtail the problems. For tests, perhaps we can use the original bug report as well as another case of using (1<<63 - 2), and any byte slice of length 3 and above.

@erikgrinaker erikgrinaker changed the title fix another overflow-related panic in decodeBytes() fix overflow-related out-of-bounds panic in decodeBytes() Dec 14, 2020
@erikgrinaker erikgrinaker merged commit a07986e into master Dec 14, 2020
@erikgrinaker erikgrinaker deleted the erik/decodebytes-redux branch December 14, 2020 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants