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

Prevent underflow #103

Open
gpersoon opened this issue Oct 12, 2021 · 0 comments
Open

Prevent underflow #103

gpersoon opened this issue Oct 12, 2021 · 0 comments

Comments

@gpersoon
Copy link

Vulnerability details

An underflow might occur at the following (if accidentally a wrong tokens is supplied):

18 - ExtendedIERC20(tokens[i]).decimals()

In solidity 6.12 the underflow means it will wrap to a large value, resulting in problems later on.

Proof of concept

decimalMultiples.push(18 - ExtendedIERC20(tokens[i]).decimals());

Recommended mitigation steps

Use the safeMath sub() function

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

No branches or pull requests

1 participant