mirror of https://github.com/crytic/slither
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
994 B
60 lines
994 B
4 years ago
|
contract Test{
|
||
|
|
||
|
uint state;
|
||
|
|
||
|
function read_state() internal returns(uint){
|
||
|
return state;
|
||
|
}
|
||
|
|
||
|
function buggy_state() internal{
|
||
|
state = 10;
|
||
|
state = 20;
|
||
|
}
|
||
|
|
||
|
function not_buggy_state() internal{
|
||
|
state = 10;
|
||
|
read_state();
|
||
|
state = 20;
|
||
|
}
|
||
|
|
||
|
function buggy_local() internal{
|
||
|
uint a;
|
||
|
a = 10;
|
||
|
a = 20;
|
||
|
}
|
||
|
|
||
|
function not_buggy_if() internal{
|
||
|
uint a = 0;
|
||
|
if(true){
|
||
|
a = 10;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function not_buggy_loop() internal{
|
||
|
|
||
|
for(uint i; i< 10; i++){
|
||
|
uint a = 10;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function not_bugy_ternary() internal{
|
||
|
uint a = true? 1 : 0;
|
||
|
}
|
||
|
|
||
|
function not_bugy_external_state() internal{
|
||
|
state = 10;
|
||
|
address a;
|
||
|
a.call("");
|
||
|
state = 11;
|
||
|
}
|
||
|
|
||
|
function bugy_external_local() internal{
|
||
|
uint local;
|
||
|
local = 10;
|
||
|
address a;
|
||
|
a.call("");
|
||
|
local = 11;
|
||
|
}
|
||
|
}
|
||
|
|