diff --git a/mythril/laser/ethereum/instructions.py b/mythril/laser/ethereum/instructions.py index 224bc58c..e7940aed 100644 --- a/mythril/laser/ethereum/instructions.py +++ b/mythril/laser/ethereum/instructions.py @@ -547,10 +547,10 @@ class Instruction: bytecode = global_state.environment.active_account.code.bytecode for i in range(concrete_size): - try: + if 2 * (concrete_code_offset + i + 1) <= len(bytecode): global_state.mstate.memory[concrete_memory_offset + i] =\ int(bytecode[2*(concrete_code_offset + i): 2*(concrete_code_offset + i + 1)], 16) - except IndexError: + else: global_state.mstate.memory[concrete_memory_offset + i] = \ BitVec("code({})".format(global_state.environment.active_account.contract_name), 256) diff --git a/mythril/leveldb/client.py b/mythril/leveldb/client.py index 210b647f..b192b004 100644 --- a/mythril/leveldb/client.py +++ b/mythril/leveldb/client.py @@ -10,7 +10,7 @@ from mythril.leveldb.eth_db import ETH_DB from mythril.ether.ethcontract import ETHContract from mythril.exceptions import AddressNotFoundError -# Per https://github.com/ethereum/go-ethereum/blob/master/core/database_util.go +# Per https://github.com/ethereum/go-ethereum/blob/master/core/rawdb/schema.go # prefixes and suffixes for keys in geth header_prefix = b'h' # header_prefix + num (uint64 big endian) + hash -> header body_prefix = b'b' # body_prefix + num (uint64 big endian) + hash -> block body @@ -23,7 +23,6 @@ head_header_key = b'LastBlock' # head (latest) header hash address_prefix = b'AM' # address_prefix + hash -> address # custom keys address_mapping_head_key = b'accountMapping' # head (latest) number of indexed block -head_header_key = b'LastBlock' # head (latest) header hash def _format_block_number(number):