diff --git a/mythril/laser/ethereum/instructions.py b/mythril/laser/ethereum/instructions.py index 19961bff..e1f196a4 100644 --- a/mythril/laser/ethereum/instructions.py +++ b/mythril/laser/ethereum/instructions.py @@ -1838,7 +1838,7 @@ class Instruction: global_state.mstate.pop(3) if global_state.last_return_data: return_val = symbol_factory.BitVecVal( - int(global_state.last_return_data, 16), 256 + int(global_state.last_return_data.return_data, 16), 256 ) else: return_val = symbol_factory.BitVecVal(0, 256) diff --git a/mythril/laser/ethereum/transaction/transaction_models.py b/mythril/laser/ethereum/transaction/transaction_models.py index c519af44..d43f7f55 100644 --- a/mythril/laser/ethereum/transaction/transaction_models.py +++ b/mythril/laser/ethereum/transaction/transaction_models.py @@ -8,6 +8,7 @@ from mythril.support.support_utils import Singleton from mythril.laser.ethereum.state.calldata import ConcreteCalldata from mythril.laser.ethereum.state.account import Account from mythril.laser.ethereum.state.calldata import BaseCalldata, SymbolicCalldata +from mythril.laser.ethereum.state.return_data import ReturnData from mythril.laser.ethereum.state.environment import Environment from mythril.laser.ethereum.state.global_state import GlobalState from mythril.laser.ethereum.state.world_state import WorldState @@ -273,9 +274,8 @@ class ContractCreationTransaction(BaseTransaction): global_state.environment.active_account.code.assign_bytecode( tuple(return_data.return_data) ) - self.return_data = str( - hex(global_state.environment.active_account.address.value) - ) + return_data = str(hex(global_state.environment.active_account.address.value)) + self.return_data = ReturnData(return_data, len(return_data) // 2) assert global_state.environment.active_account.code.instruction_list != [] raise TransactionEndSignal(global_state, revert=revert) diff --git a/solidity_examples/killbilly.sol b/solidity_examples/killbilly.sol new file mode 100644 index 00000000..7ec388ba --- /dev/null +++ b/solidity_examples/killbilly.sol @@ -0,0 +1,24 @@ +pragma solidity 0.5.7; + +contract KillBilly { + bool public is_killable; + mapping (address => bool) public approved_killers; + + constructor() public { + is_killable = false; + } + + function killerize(address addr) public { + approved_killers[addr] = true; + } + + function activatekillability() public { + require(approved_killers[msg.sender] == true); + is_killable = true; + } + + function commencekilling() public { + require(is_killable); + selfdestruct(msg.sender); + } +} \ No newline at end of file