-
Notifications
You must be signed in to change notification settings - Fork 741
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
Incoherent overflow detection #1853
Comments
Hi @gsalzer, this is because, for all important overflows, solc versions post 0.8.0 adds an assert to check for violations. Hence, 0.8.0 does not detect any overflow issues. I get no issues for versions post 0.8.0 irrespective of using |
@norhh Re 0.8.x: Yes, I know about the overflow and underflow checks, so the table
is the one to be expected. However, for solc 0.8.25 and runtime code, i.e., the command ./myth a --bin-runtime --unconstrained-storage -c `solc --bin-runtime c.sol | tail -1` I get indeed
So it seems that Mythril handles If you get different results: I'm using |
@norhh Re 0.4.26: It does not matter that the compiler is outdated, as the point is to analyze Mythril's capability to analyze bytecode. The unsystematic results may point to a weakness of Mythril's static analysis, either the method or its implementation. Even if we assume that Z3 behaves differently for addition and multiplication, uint and int, 256 and 248 (it most certainly does), the irregular matrix is surprising. |
Description
Consider the following Solidity source
c.sol
:These are 16 source files (2 compilers, 4 types, 2 operations).
solc 0.4.26
Running the commands
yields
The command
./myth a --bin-runtime -c `solc --bin-runtime c.sol | tail -1`
yields
no issues
for all variants (probably to be expected), whereas./myth a --bin-runtime --unconstrained-storage -c `solc --bin-runtime c.sol | tail -1`
yields
solc 0.8.25
For this compiler version, the two tables from above look like
Expected behavior
I'd expected Mythril to detect overflows more consistently, maybe just for (u)int256 and not for (u)int248 (if it is not able to infer the smaller type size), or just for addition and not multiplication, but not this patchwork.
Environment
Mythril:
0.24.8
Python:
3.10.12
Solc:
0.4.26+commit.4563c3fc.Linux.g++
/0.8.25+commit.b61c2a91.Linux.g++
OS: Ubuntu Linux 22.04
The text was updated successfully, but these errors were encountered: