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

overflow possible in get Imbalance - very low likliehood. #240

Open
ilanDoron opened this issue Jun 26, 2018 · 1 comment
Open

overflow possible in get Imbalance - very low likliehood. #240

ilanDoron opened this issue Jun 26, 2018 · 1 comment

Comments

@ilanDoron
Copy link
Contributor

In the getImbalance function, the multiplication totalImbalance *= resolution is performed unchecked.
Since the resolution field can be arbitrarily big and totalImbalance can reach 2

63−1, overflows are possible.

A check on writing the resolution variable could be introduced to avoid this.
Since the function is only used to retrieve information and in a benevolent case resolution should not be
this big, this is unlikely. But because this function is used in the getRate function, a consequence could be
returning a wrong rate to users.
The same applies to currentBlockImbalance *= resolution.

@manhlx3006
Copy link
Contributor

Adjusted in this PR #422

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants