From 30d3b9a74ee0c0b5e240836373ffe73a9bcd092d Mon Sep 17 00:00:00 2001 From: Nathan Date: Mon, 7 Jan 2019 14:15:13 -0500 Subject: [PATCH] Cleanup get_call_data --- mythril/laser/ethereum/call.py | 32 +++++++++++++------------------- 1 file changed, 13 insertions(+), 19 deletions(-) diff --git a/mythril/laser/ethereum/call.py b/mythril/laser/ethereum/call.py index 219aa804..e99e60cd 100644 --- a/mythril/laser/ethereum/call.py +++ b/mythril/laser/ethereum/call.py @@ -179,29 +179,23 @@ def get_call_data( else memory_size ) + uses_entire_calldata = simplify( + memory_size - global_state.environment.calldata.calldatasize == 0 + ) + + if uses_entire_calldata == True: + return global_state.environment.calldata + try: - uses_entire_calldata = False - try: - uses_entire_calldata = simplify( - memory_size - global_state.environment.calldata.calldatasize == 0 + calldata_from_mem = state.memory[ + util.get_concrete_int(memory_start) : util.get_concrete_int( + memory_start + memory_size ) - except Z3Exception: - pass - - if uses_entire_calldata: - call_data = global_state.environment.calldata - else: - calldata_from_mem = state.memory[ - util.get_concrete_int(memory_start) : util.get_concrete_int( - memory_start + memory_size - ) - ] - call_data = ConcreteCalldata(transaction_id, calldata_from_mem) + ] + return ConcreteCalldata(transaction_id, calldata_from_mem) except TypeError: log.debug("Unsupported symbolic calldata offset") - call_data = SymbolicCalldata(transaction_id) - - return call_data + return SymbolicCalldata(transaction_id) def native_call(