Remove cases with out of bounds access (#1396)

* Remove cases with out of bounds access

* Fix the EVM tests

Co-authored-by: Nikhil Parasaram <nikhilparasaram@Nikhils-MacBook-Pro.local>
pull/1399/head
Nikhil Parasaram 5 years ago committed by GitHub
parent 88c64e56cd
commit 6ed8a5dc4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      mythril/laser/ethereum/svm.py
  2. 8
      mythril/laser/plugin/plugins/dependency_pruner.py

@ -489,6 +489,12 @@ class LaserEVM:
:param edge_type: :param edge_type:
:param condition: :param condition:
""" """
try:
address = state.environment.code.instruction_list[state.mstate.pc][
"address"
]
except IndexError:
return
new_node = Node(state.environment.active_account.contract_name) new_node = Node(state.environment.active_account.contract_name)
old_node = state.node old_node = state.node
state.node = new_node state.node = new_node
@ -512,8 +518,6 @@ class LaserEVM:
except StackUnderflowException: except StackUnderflowException:
new_node.flags |= NodeFlags.FUNC_ENTRY new_node.flags |= NodeFlags.FUNC_ENTRY
address = state.environment.code.instruction_list[state.mstate.pc]["address"]
environment = state.environment environment = state.environment
disassembly = environment.code disassembly = environment.code
if isinstance( if isinstance(

@ -207,8 +207,10 @@ class DependencyPruner(LaserPlugin):
@symbolic_vm.post_hook("JUMP") @symbolic_vm.post_hook("JUMP")
def jump_hook(state: GlobalState): def jump_hook(state: GlobalState):
try:
address = state.get_current_instruction()["address"] address = state.get_current_instruction()["address"]
except IndexError:
raise PluginSkipState
annotation = get_dependency_annotation(state) annotation = get_dependency_annotation(state)
annotation.path.append(address) annotation.path.append(address)
@ -216,8 +218,10 @@ class DependencyPruner(LaserPlugin):
@symbolic_vm.post_hook("JUMPI") @symbolic_vm.post_hook("JUMPI")
def jumpi_hook(state: GlobalState): def jumpi_hook(state: GlobalState):
try:
address = state.get_current_instruction()["address"] address = state.get_current_instruction()["address"]
except IndexError:
raise PluginSkipState
annotation = get_dependency_annotation(state) annotation = get_dependency_annotation(state)
annotation.path.append(address) annotation.path.append(address)

Loading…
Cancel
Save