-
Notifications
You must be signed in to change notification settings - Fork 979
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
454 additions
and
0 deletions.
There are no files selected for viewing
17 changes: 17 additions & 0 deletions
17
tests/detectors/wrongencodeselector/0.8.0/wrongencodeselector.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
contract Test { | ||
event Val(uint, uint); | ||
function f(uint a, uint b) public { | ||
emit Val(a, b); | ||
} | ||
} | ||
contract D { | ||
function bad() public { | ||
Test t = new Test(); | ||
address(t).call(abi.encodeWithSelector(Test.f.selector,"test")); | ||
} | ||
function good() public { | ||
Test t = new Test(); | ||
address(t).call(abi.encodeWithSelector(Test.f.selector, 1, 2)); | ||
} | ||
} | ||
|
137 changes: 137 additions & 0 deletions
137
...tors/wrongencodeselector/0.8.0/wrongencodeselector.sol.0.8.0.WrongEncodeWithSelector.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
[ | ||
[ | ||
{ | ||
"elements": [ | ||
{ | ||
"type": "function", | ||
"name": "bad", | ||
"source_mapping": { | ||
"start": 135, | ||
"length": 131, | ||
"filename_used": "/GENERIC_PATH", | ||
"filename_relative": "tests/detectors/wrongencodeselector/0.8.0/wrongencodeselector.sol", | ||
"filename_absolute": "/GENERIC_PATH", | ||
"filename_short": "tests/detectors/wrongencodeselector/0.8.0/wrongencodeselector.sol", | ||
"is_dependency": false, | ||
"lines": [ | ||
8, | ||
9, | ||
10, | ||
11 | ||
], | ||
"starting_column": 5, | ||
"ending_column": 6 | ||
}, | ||
"type_specific_fields": { | ||
"parent": { | ||
"type": "contract", | ||
"name": "D", | ||
"source_mapping": { | ||
"start": 118, | ||
"length": 286, | ||
"filename_used": "/GENERIC_PATH", | ||
"filename_relative": "tests/detectors/wrongencodeselector/0.8.0/wrongencodeselector.sol", | ||
"filename_absolute": "/GENERIC_PATH", | ||
"filename_short": "tests/detectors/wrongencodeselector/0.8.0/wrongencodeselector.sol", | ||
"is_dependency": false, | ||
"lines": [ | ||
7, | ||
8, | ||
9, | ||
10, | ||
11, | ||
12, | ||
13, | ||
14, | ||
15, | ||
16 | ||
], | ||
"starting_column": 1, | ||
"ending_column": 2 | ||
} | ||
}, | ||
"signature": "bad()" | ||
} | ||
}, | ||
{ | ||
"type": "node", | ||
"name": "address(t).call(abi.encodeWithSelector(Test.f.selector,test))", | ||
"source_mapping": { | ||
"start": 196, | ||
"length": 63, | ||
"filename_used": "/GENERIC_PATH", | ||
"filename_relative": "tests/detectors/wrongencodeselector/0.8.0/wrongencodeselector.sol", | ||
"filename_absolute": "/GENERIC_PATH", | ||
"filename_short": "tests/detectors/wrongencodeselector/0.8.0/wrongencodeselector.sol", | ||
"is_dependency": false, | ||
"lines": [ | ||
10 | ||
], | ||
"starting_column": 9, | ||
"ending_column": 72 | ||
}, | ||
"type_specific_fields": { | ||
"parent": { | ||
"type": "function", | ||
"name": "bad", | ||
"source_mapping": { | ||
"start": 135, | ||
"length": 131, | ||
"filename_used": "/GENERIC_PATH", | ||
"filename_relative": "tests/detectors/wrongencodeselector/0.8.0/wrongencodeselector.sol", | ||
"filename_absolute": "/GENERIC_PATH", | ||
"filename_short": "tests/detectors/wrongencodeselector/0.8.0/wrongencodeselector.sol", | ||
"is_dependency": false, | ||
"lines": [ | ||
8, | ||
9, | ||
10, | ||
11 | ||
], | ||
"starting_column": 5, | ||
"ending_column": 6 | ||
}, | ||
"type_specific_fields": { | ||
"parent": { | ||
"type": "contract", | ||
"name": "D", | ||
"source_mapping": { | ||
"start": 118, | ||
"length": 286, | ||
"filename_used": "/GENERIC_PATH", | ||
"filename_relative": "tests/detectors/wrongencodeselector/0.8.0/wrongencodeselector.sol", | ||
"filename_absolute": "/GENERIC_PATH", | ||
"filename_short": "tests/detectors/wrongencodeselector/0.8.0/wrongencodeselector.sol", | ||
"is_dependency": false, | ||
"lines": [ | ||
7, | ||
8, | ||
9, | ||
10, | ||
11, | ||
12, | ||
13, | ||
14, | ||
15, | ||
16 | ||
], | ||
"starting_column": 1, | ||
"ending_column": 2 | ||
} | ||
}, | ||
"signature": "bad()" | ||
} | ||
} | ||
} | ||
} | ||
], | ||
"description": "D.bad() (tests/detectors/wrongencodeselector/0.8.0/wrongencodeselector.sol#8-11) calls abi.encodeWithSelector() with wrong arguments ataddress(t).call(abi.encodeWithSelector(Test.f.selector,test)) (tests/detectors/wrongencodeselector/0.8.0/wrongencodeselector.sol#10)", | ||
"markdown": "[D.bad()](tests/detectors/wrongencodeselector/0.8.0/wrongencodeselector.sol#L8-L11) calls abi.encodeWithSelector() with wrong arguments at[address(t).call(abi.encodeWithSelector(Test.f.selector,test))](tests/detectors/wrongencodeselector/0.8.0/wrongencodeselector.sol#L10)", | ||
"first_markdown_element": "tests/detectors/wrongencodeselector/0.8.0/wrongencodeselector.sol#L8-L11", | ||
"id": "9230578efcdc63464cf775b07aaf1d04e77ea58363f4809b7f6ffb1dcd46e34f", | ||
"check": "wrongencodeselector", | ||
"impact": "Medium", | ||
"confidence": "High" | ||
} | ||
] | ||
] |
137 changes: 137 additions & 0 deletions
137
...ors/wrongencodeselector/0.8.0/wrongencodeselector.sol.0.8.15.WrongEncodeWithSelector.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
[ | ||
[ | ||
{ | ||
"elements": [ | ||
{ | ||
"type": "function", | ||
"name": "bad", | ||
"source_mapping": { | ||
"start": 135, | ||
"length": 131, | ||
"filename_used": "/GENERIC_PATH", | ||
"filename_relative": "tests/detectors/wrongencodeselector/0.8.15/wrongencodeselector.sol", | ||
"filename_absolute": "/GENERIC_PATH", | ||
"filename_short": "tests/detectors/wrongencodeselector/0.8.15/wrongencodeselector.sol", | ||
"is_dependency": false, | ||
"lines": [ | ||
8, | ||
9, | ||
10, | ||
11 | ||
], | ||
"starting_column": 5, | ||
"ending_column": 6 | ||
}, | ||
"type_specific_fields": { | ||
"parent": { | ||
"type": "contract", | ||
"name": "D", | ||
"source_mapping": { | ||
"start": 118, | ||
"length": 286, | ||
"filename_used": "/GENERIC_PATH", | ||
"filename_relative": "tests/detectors/wrongencodeselector/0.8.15/wrongencodeselector.sol", | ||
"filename_absolute": "/GENERIC_PATH", | ||
"filename_short": "tests/detectors/wrongencodeselector/0.8.15/wrongencodeselector.sol", | ||
"is_dependency": false, | ||
"lines": [ | ||
7, | ||
8, | ||
9, | ||
10, | ||
11, | ||
12, | ||
13, | ||
14, | ||
15, | ||
16 | ||
], | ||
"starting_column": 1, | ||
"ending_column": 2 | ||
} | ||
}, | ||
"signature": "bad()" | ||
} | ||
}, | ||
{ | ||
"type": "node", | ||
"name": "address(t).call(abi.encodeWithSelector(Test.f.selector,test))", | ||
"source_mapping": { | ||
"start": 196, | ||
"length": 63, | ||
"filename_used": "/GENERIC_PATH", | ||
"filename_relative": "tests/detectors/wrongencodeselector/0.8.15/wrongencodeselector.sol", | ||
"filename_absolute": "/GENERIC_PATH", | ||
"filename_short": "tests/detectors/wrongencodeselector/0.8.15/wrongencodeselector.sol", | ||
"is_dependency": false, | ||
"lines": [ | ||
10 | ||
], | ||
"starting_column": 9, | ||
"ending_column": 72 | ||
}, | ||
"type_specific_fields": { | ||
"parent": { | ||
"type": "function", | ||
"name": "bad", | ||
"source_mapping": { | ||
"start": 135, | ||
"length": 131, | ||
"filename_used": "/GENERIC_PATH", | ||
"filename_relative": "tests/detectors/wrongencodeselector/0.8.15/wrongencodeselector.sol", | ||
"filename_absolute": "/GENERIC_PATH", | ||
"filename_short": "tests/detectors/wrongencodeselector/0.8.15/wrongencodeselector.sol", | ||
"is_dependency": false, | ||
"lines": [ | ||
8, | ||
9, | ||
10, | ||
11 | ||
], | ||
"starting_column": 5, | ||
"ending_column": 6 | ||
}, | ||
"type_specific_fields": { | ||
"parent": { | ||
"type": "contract", | ||
"name": "D", | ||
"source_mapping": { | ||
"start": 118, | ||
"length": 286, | ||
"filename_used": "/GENERIC_PATH", | ||
"filename_relative": "tests/detectors/wrongencodeselector/0.8.15/wrongencodeselector.sol", | ||
"filename_absolute": "/GENERIC_PATH", | ||
"filename_short": "tests/detectors/wrongencodeselector/0.8.15/wrongencodeselector.sol", | ||
"is_dependency": false, | ||
"lines": [ | ||
7, | ||
8, | ||
9, | ||
10, | ||
11, | ||
12, | ||
13, | ||
14, | ||
15, | ||
16 | ||
], | ||
"starting_column": 1, | ||
"ending_column": 2 | ||
} | ||
}, | ||
"signature": "bad()" | ||
} | ||
} | ||
} | ||
} | ||
], | ||
"description": "D.bad() (tests/detectors/wrongencodeselector/0.8.15/wrongencodeselector.sol#8-11) calls abi.encodeWithSelector() with wrong arguments ataddress(t).call(abi.encodeWithSelector(Test.f.selector,test)) (tests/detectors/wrongencodeselector/0.8.15/wrongencodeselector.sol#10)", | ||
"markdown": "[D.bad()](tests/detectors/wrongencodeselector/0.8.15/wrongencodeselector.sol#L8-L11) calls abi.encodeWithSelector() with wrong arguments at[address(t).call(abi.encodeWithSelector(Test.f.selector,test))](tests/detectors/wrongencodeselector/0.8.15/wrongencodeselector.sol#L10)", | ||
"first_markdown_element": "tests/detectors/wrongencodeselector/0.8.15/wrongencodeselector.sol#L8-L11", | ||
"id": "b47ae579712e33679731aa3f91fdf7221e6a3cfe1b16bfdf1da9d791c6c65ee8", | ||
"check": "wrongencodeselector", | ||
"impact": "Medium", | ||
"confidence": "High" | ||
} | ||
] | ||
] |
17 changes: 17 additions & 0 deletions
17
tests/detectors/wrongencodeselector/0.8.15/wrongencodeselector.sol
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
contract Test { | ||
event Val(uint, uint); | ||
function f(uint a, uint b) public { | ||
emit Val(a, b); | ||
} | ||
} | ||
contract D { | ||
function bad() public { | ||
Test t = new Test(); | ||
address(t).call(abi.encodeWithSelector(Test.f.selector,"test")); | ||
} | ||
function good() public { | ||
Test t = new Test(); | ||
address(t).call(abi.encodeWithSelector(Test.f.selector, 1, 2)); | ||
} | ||
} | ||
|
Oops, something went wrong.