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

[Bug-Candidate]: slither fails to handle overflow literal operations #2646

Open
lum7na opened this issue Jan 25, 2025 · 0 comments
Open

[Bug-Candidate]: slither fails to handle overflow literal operations #2646

lum7na opened this issue Jan 25, 2025 · 0 comments
Labels
bug-candidate Bugs reports that are not yet confirmed

Comments

@lum7na
Copy link

lum7na commented Jan 25, 2025

Describe the issue:

Tests were conducted using solc versions 0.8.27 and 0.8.28, and both failed to generate IR. The bug persists in the latest release.

I believe there should be more robust handling here, as mentioned in the Solidity documentation:

Number literal expressions retain arbitrary precision until they are converted to a non-literal type (i.e. by using them together with anything other than a number literal expression (like boolean literals) or by explicit conversion). This means that computations do not overflow and divisions do not truncate in number literal expressions.

Code:

contract C {
  function test() public returns(int) {
    return (-1) ** 1e100;
  }
}

Run slither: slither a.sol

Output:

ERROR:SlitherSolcParsing:
Failed to generate IR for C.test. Please open an issue https://github.com/crytic/slither/issues.
C.test (a.sol#3-5):
        (- 1) ** 1e100
Traceback (most recent call last):
...
ERROR:root:Error:
ERROR:root:1e100 is too large to fit in any Solidity integer size
ERROR:root:Please report an issue to https://github.com/crytic/slither/issues

Code example to reproduce the issue:

contract C {
  function test() public returns(int) {
    return (-1) ** 1e100;
  }
}

Version:

0.11.0

Relevant log output:

@lum7na lum7na added the bug-candidate Bugs reports that are not yet confirmed label Jan 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-candidate Bugs reports that are not yet confirmed
Projects
None yet
Development

No branches or pull requests

1 participant