This repository was archived by the owner on Mar 6, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 87
This repository was archived by the owner on Mar 6, 2024. It is now read-only.
UnboundLocalError when using dynamic analysis #10
Copy link
Copy link
Open
Labels
Description
Some EVM bytecode inputs result in an UnboundLocalError exception. For example:
$ python octopus_eth_evm.py -g -r "6080604052348015600f57600080fd5b506004361060465760003560e01c80632f576f2014604b57806381b36467146067578063a0ef91df14606f578063bcb4ab0e146077575b600080fd5b6051607f565b6040518082815260200191505060405180910390f35b606d6088565b005b60756094565b005b607d60f3565b005b60008054905090565b6001600014609257fe5b565b3373ffffffffffffffffffffffffffffffffffffffff166108fc3073ffffffffffffffffffffffffffffffffffffffff16319081150290604051600060405180830381858888f1935050505015801560f0573d6000803e3d6000fd5b50565b600160008190555056fea165627a7a7230582097b073d8789a43fedeb6be6929b92747b0ddbcfd568d5c737d90ea40ce8efe9f0029"
Traceback (most recent call last):
File "octopus_eth_evm.py", line 186, in <module>
main()
File "octopus_eth_evm.py", line 164, in main
octo_cfg = EthereumCFG(octo_bytecode)
File "/Users/bernhardmueller/Projects/octopus/octopus/platforms/ETH/cfg.py", line 9, in __new__
return EvmCFG(bytecode, analysis=evm_analysis)
File "/Users/bernhardmueller/Projects/octopus/octopus/arch/evm/cfg.py", line 160, in __init__
self.run_dynamic_analysis()
File "/Users/bernhardmueller/Projects/octopus/octopus/arch/evm/cfg.py", line 173, in run_dynamic_analysis
emul.emulate()
File "/Users/bernhardmueller/Projects/octopus/octopus/platforms/ETH/emulator.py", line 122, in emulate
halt = self.emulate_one_instruction(instr, state, depth)
File "/Users/bernhardmueller/Projects/octopus/octopus/platforms/ETH/emulator.py", line 168, in emulate_one_instruction
halt = self.ssa_stack_memory_storage_flow_instruction(instr, state, depth)
File "/Users/bernhardmueller/Projects/octopus/octopus/platforms/ETH/emulator.py", line 433, in ssa_stack_memory_storage_flow_instruction
self.emulate(new_state, depth=depth + 1)
File "/Users/bernhardmueller/Projects/octopus/octopus/platforms/ETH/emulator.py", line 122, in emulate
halt = self.emulate_one_instruction(instr, state, depth)
File "/Users/bernhardmueller/Projects/octopus/octopus/platforms/ETH/emulator.py", line 168, in emulate_one_instruction
halt = self.ssa_stack_memory_storage_flow_instruction(instr, state, depth)
File "/Users/bernhardmueller/Projects/octopus/octopus/platforms/ETH/emulator.py", line 400, in ssa_stack_memory_storage_flow_instruction
self.emulate(new_state, depth=depth + 1)
File "/Users/bernhardmueller/Projects/octopus/octopus/platforms/ETH/emulator.py", line 122, in emulate
halt = self.emulate_one_instruction(instr, state, depth)
File "/Users/bernhardmueller/Projects/octopus/octopus/platforms/ETH/emulator.py", line 148, in emulate_one_instruction
self.emul_comparaison_logic_instruction(instr, state)
File "/Users/bernhardmueller/Projects/octopus/octopus/platforms/ETH/emulator.py", line 261, in emul_comparaison_logic_instruction
instr.name, args=args)
UnboundLocalError: local variable 'args' referenced before assignment
The bytecode was generated with solc 0.5.7 from the following source:
pragma solidity ^0.5.0;
contract Test {
uint256 myinteger;
function doNothing() public view returns (uint256) {
return myinteger;
}
function write() public {
myinteger = 1;
}
function alwaysfail() public {
assert(0 == 1);
}
function withdrawEth() public {
msg.sender.transfer(address(this).balance);
}
}
fiercef3l1n3