mirror of https://github.com/ConsenSys/mythril
blockchainethereumsmart-contractssoliditysecurityprogram-analysissecurity-analysissymbolic-execution
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.
48 lines
924 B
48 lines
924 B
pragma solidity ^0.5.0;
|
|
|
|
|
|
contract Exceptions {
|
|
|
|
uint256[8] myarray;
|
|
|
|
function assert1() public pure {
|
|
uint256 i = 1;
|
|
assert(i == 0);
|
|
}
|
|
|
|
function assert2() public pure {
|
|
uint256 i = 1;
|
|
assert(i > 0);
|
|
}
|
|
|
|
function assert3(uint256 input) public pure {
|
|
if (input > 10) {
|
|
assert(input != 23);
|
|
}
|
|
}
|
|
|
|
function requireisfine(uint256 input) public pure {
|
|
require(input != 23);
|
|
}
|
|
|
|
function divisionby0(uint256 input) public pure {
|
|
uint256 i = 1/input;
|
|
}
|
|
|
|
function thisisfine(uint256 input) public pure {
|
|
if (input > 0) {
|
|
uint256 i = 1/input;
|
|
}
|
|
}
|
|
|
|
function arrayaccess(uint256 index) public view {
|
|
uint256 i = myarray[index];
|
|
}
|
|
|
|
function thisisalsofind(uint256 index) public view {
|
|
if (index < 8) {
|
|
uint256 i = myarray[index];
|
|
}
|
|
}
|
|
|
|
}
|
|
|