Merge pull request #6248 from ethereum/shiftopt-fix-overflow

Fixes u256 overflow in logical shift optimization rule and adds tests.
This commit is contained in:
chriseth
2019-03-13 12:02:33 +01:00
committed by GitHub
7 changed files with 80 additions and 5 deletions
+12
View File
@@ -1,4 +1,16 @@
[
{
"name": "DoubleShiftSizeOverflow",
"summary": "Double bitwise shifts by large constants whose sum overflows 256 bits can result in unexpected values.",
"description": "Nested logical shift operations whose total shift size is 2**256 or more are incorrectly optimized. This only applies to shifts by numbers of bits that are compile-time constant expressions.",
"introduced": "0.5.5",
"fixed": "0.5.6",
"severity": "low",
"conditions": {
"optimizer": true,
"evmVersion": ">=constantinople"
}
},
{
"name": "ExpExponentCleanup",
"summary": "Using the ** operator with an exponent of type shorter than 256 bits can result in unexpected values.",
+8 -2
View File
@@ -52,9 +52,15 @@ severity
discoverability in contract tests, likelihood of occurrence and
potential damage by exploits.
conditions
Conditions that have to be met to trigger the bug. Currently, this
is an object that can contain a boolean value ``optimizer``, which
Conditions that have to be met to trigger the bug. The following
keys can be used:
``optimizer``, Boolean value which
means that the optimizer has to be switched on to enable the bug.
``evmVersion``, a string that indicates which EVM version compiler
settings trigger the bug. The string can contain comparison
operators. For example, ``">=constantinople"`` means that the bug
is present when the EVM version is set to ``constantinople`` or
later.
If no conditions are given, assume that the bug is present.
check
This field contains different checks that report whether the smart contract
+3 -1
View File
@@ -630,7 +630,9 @@
"released": "2019-02-12"
},
"0.5.5": {
"bugs": [],
"bugs": [
"DoubleShiftSizeOverflow"
],
"released": "2019-03-05"
}
}