From 290aaf81988e55366100c900dae4bb5b767c499e Mon Sep 17 00:00:00 2001 From: Joran Honig Date: Sat, 7 Jul 2018 22:16:01 +0200 Subject: [PATCH 1/5] Add condition not 0 --- mythril/laser/ethereum/call.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mythril/laser/ethereum/call.py b/mythril/laser/ethereum/call.py index 483894ce..58eafed3 100644 --- a/mythril/laser/ethereum/call.py +++ b/mythril/laser/ethereum/call.py @@ -36,7 +36,7 @@ def get_call_parameters(global_state, dynamic_loader, with_value=False): callee_account = None call_data, call_data_type = get_call_data(global_state, meminstart, meminsz, False) - if int(callee_address, 16) >= 5: + if int(callee_address, 16) >= 5 or int(callee_address) != 0: call_data, call_data_type = get_call_data(global_state, meminstart, meminsz) callee_account = get_callee_account(global_state, callee_address, dynamic_loader) From c3d1eb85c36ccb0f46f638f01d05f90d82b6dbb5 Mon Sep 17 00:00:00 2001 From: Joran Honig Date: Sat, 7 Jul 2018 22:16:47 +0200 Subject: [PATCH 2/5] Pass None as node --- mythril/laser/ethereum/instructions.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mythril/laser/ethereum/instructions.py b/mythril/laser/ethereum/instructions.py index 4d90da95..72451f48 100644 --- a/mythril/laser/ethereum/instructions.py +++ b/mythril/laser/ethereum/instructions.py @@ -913,7 +913,7 @@ class Instruction: value, environment.origin, calldata_type=call_data_type) - new_global_state = GlobalState(global_state.accounts, callee_environment, MachineState(gas)) + new_global_state = GlobalState(global_state.accounts, callee_environment, None, MachineState(gas)) new_global_state.mstate.depth = global_state.mstate.depth + 1 new_global_state.mstate.constraints = copy(global_state.mstate.constraints) return [global_state] @@ -940,7 +940,7 @@ class Instruction: environment.caller = environment.address environment.calldata = call_data - new_global_state = GlobalState(global_state.accounts, environment, MachineState(gas)) + new_global_state = GlobalState(global_state.accounts, environment, None, MachineState(gas)) new_global_state.mstate.depth = global_state.mstate.depth + 1 new_global_state.mstate.constraints = copy(global_state.mstate.constraints) @@ -968,7 +968,7 @@ class Instruction: environment.code = callee_account.code environment.calldata = call_data - new_global_state = GlobalState(global_state.accounts, environment, MachineState(gas)) + new_global_state = GlobalState(global_state.accounts, environment, None, MachineState(gas)) new_global_state.mstate.depth = global_state.mstate.depth + 1 new_global_state.mstate.constraints = copy(global_state.mstate.constraints) From 09c41deb6370ffdb548e9df04d7722e55b38c39b Mon Sep 17 00:00:00 2001 From: Joran Honig Date: Sat, 7 Jul 2018 22:43:01 +0200 Subject: [PATCH 3/5] Fix node issue --- mythril/laser/ethereum/instructions.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mythril/laser/ethereum/instructions.py b/mythril/laser/ethereum/instructions.py index 72451f48..56456fdd 100644 --- a/mythril/laser/ethereum/instructions.py +++ b/mythril/laser/ethereum/instructions.py @@ -913,7 +913,7 @@ class Instruction: value, environment.origin, calldata_type=call_data_type) - new_global_state = GlobalState(global_state.accounts, callee_environment, None, MachineState(gas)) + new_global_state = GlobalState(global_state.accounts, callee_environment, global_state.node, MachineState(gas)) new_global_state.mstate.depth = global_state.mstate.depth + 1 new_global_state.mstate.constraints = copy(global_state.mstate.constraints) return [global_state] @@ -940,7 +940,7 @@ class Instruction: environment.caller = environment.address environment.calldata = call_data - new_global_state = GlobalState(global_state.accounts, environment, None, MachineState(gas)) + new_global_state = GlobalState(global_state.accounts, environment, global_state.node, MachineState(gas)) new_global_state.mstate.depth = global_state.mstate.depth + 1 new_global_state.mstate.constraints = copy(global_state.mstate.constraints) @@ -968,7 +968,7 @@ class Instruction: environment.code = callee_account.code environment.calldata = call_data - new_global_state = GlobalState(global_state.accounts, environment, None, MachineState(gas)) + new_global_state = GlobalState(global_state.accounts, environment, global_state.node, MachineState(gas)) new_global_state.mstate.depth = global_state.mstate.depth + 1 new_global_state.mstate.constraints = copy(global_state.mstate.constraints) From 7c638272cbe936ba40cea9d0b5552e0edebeb6aa Mon Sep 17 00:00:00 2001 From: Joran Honig Date: Sat, 7 Jul 2018 23:12:49 +0200 Subject: [PATCH 4/5] Reverse comparison --- mythril/laser/ethereum/call.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mythril/laser/ethereum/call.py b/mythril/laser/ethereum/call.py index 58eafed3..63d09837 100644 --- a/mythril/laser/ethereum/call.py +++ b/mythril/laser/ethereum/call.py @@ -36,7 +36,7 @@ def get_call_parameters(global_state, dynamic_loader, with_value=False): callee_account = None call_data, call_data_type = get_call_data(global_state, meminstart, meminsz, False) - if int(callee_address, 16) >= 5 or int(callee_address) != 0: + if int(callee_address, 16) >= 5 or int(callee_address) == 0: call_data, call_data_type = get_call_data(global_state, meminstart, meminsz) callee_account = get_callee_account(global_state, callee_address, dynamic_loader) From 9b5bd6de777e57d48af26f5a26d04f86e8690c93 Mon Sep 17 00:00:00 2001 From: Joran Honig Date: Sun, 8 Jul 2018 14:56:24 +0200 Subject: [PATCH 5/5] Use base 16 --- mythril/laser/ethereum/call.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mythril/laser/ethereum/call.py b/mythril/laser/ethereum/call.py index 63d09837..aee2f30c 100644 --- a/mythril/laser/ethereum/call.py +++ b/mythril/laser/ethereum/call.py @@ -36,7 +36,7 @@ def get_call_parameters(global_state, dynamic_loader, with_value=False): callee_account = None call_data, call_data_type = get_call_data(global_state, meminstart, meminsz, False) - if int(callee_address, 16) >= 5 or int(callee_address) == 0: + if int(callee_address, 16) >= 5 or int(callee_address, 16) == 0: call_data, call_data_type = get_call_data(global_state, meminstart, meminsz) callee_account = get_callee_account(global_state, callee_address, dynamic_loader)