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

Fixing DOS large exponent in scientific notation constants. #608

Merged
merged 5 commits into from
Aug 31, 2020

Conversation

laudiacay
Copy link
Contributor

Fixes issue #579.

The issue was that slither was computing 10**HUGE_NUMBER eagerly in order to multiply it with the first part of the scientific notation.... which takes a while, and eats up lots of memory, because we're using bignums for this. I changed the behavior so that, if the first part is zero, just return zero. Otherwise, if the exponent is greater than 80, raise a ValueError, because there's no way the result will fit into a solidity integer type unless they're just writing it out in a really really troll-y way.

This will raise on something like 0.{80 zeros}1E80. Not sure if solc supports that, but if we wanted to, we could add some sort of behavior with alternately multiplying the base by 10 and decrementing the exponent until it's zero... but that'd require some checks too to make sure the exponent isn't still too large.

@CLAassistant
Copy link

CLAassistant commented Aug 28, 2020

CLA assistant check
All committers have signed the CLA.

@laudiacay
Copy link
Contributor Author

also fixing #587 by just adding another decimal cast

@montyly montyly changed the base branch from master to dev August 28, 2020 07:16
@montyly montyly merged commit 66b98da into crytic:dev Aug 31, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants