From 1a0ea91267af3323c71b44f1d1c44b20a9339e65 Mon Sep 17 00:00:00 2001 From: e-ngo Date: Wed, 7 Aug 2019 15:20:00 -0700 Subject: [PATCH] Refactored instructions for extcodehash and its test --- mythril/laser/ethereum/instructions.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mythril/laser/ethereum/instructions.py b/mythril/laser/ethereum/instructions.py index 531aaf03..17173363 100644 --- a/mythril/laser/ethereum/instructions.py +++ b/mythril/laser/ethereum/instructions.py @@ -1166,15 +1166,14 @@ class Instruction: """ world_state = global_state.world_state stack = global_state.mstate.stack - address = stack.pop() + address = Extract(159, 0, stack.pop()) + if address.symbolic: log.debug("unsupported symbolic address for EXTCODEHASH") stack.append(global_state.new_bitvec("extcodehash_" + str(address), 256)) return [global_state] address = address.value - - mask = int((symbol_factory.BitVecVal(TT256M1, 256) >> 96).value) - address = address & mask + if address not in world_state.accounts: code_hash = symbol_factory.BitVecVal(0, 256) else: