diff --git a/mythril/laser/ethereum/svm.py b/mythril/laser/ethereum/svm.py index b6d722c9..f864f8c1 100644 --- a/mythril/laser/ethereum/svm.py +++ b/mythril/laser/ethereum/svm.py @@ -1,4 +1,5 @@ from mythril.laser.ethereum import helper, natives +from mythril import mythril from ethereum import utils from enum import Enum from flags import Flags @@ -677,7 +678,22 @@ class LaserEVM: elif op == 'EXTCODESIZE': addr = state.stack.pop() - state.stack.append(BitVec("extcodesize", 256)) + myth = mythril.Mythril() + try: + myth.set_api_rpc_infura() + except Exception as e: + logging.info("Error while connecting to infura") + state.stack.append(BitVec("extcodesize", 256)) + continue + + try: + _, code = myth.load_from_address(hex(helper.get_concrete_int(addr))) + except AttributeError: + logging.info("EXTCODECOPY is called with symbolic addr") + state.stack.append(BitVec("extcodesize", 256)) + continue + + state.stack.append(len(code.code) // 2) elif op == 'EXTCODECOPY': # Not implemented