Implement norhh suggestions

pull/1041/head
Bernhard Mueller 6 years ago
parent fca8dd01fb
commit 386855ae2f
  1. 9
      mythril/analysis/modules/dos.py

@ -56,12 +56,11 @@ class DOS(DetectionModule):
target = util.get_concrete_int(state.mstate.stack[-1]) target = util.get_concrete_int(state.mstate.stack[-1])
try: transaction = state.current_transaction
transaction = state.current_transaction if state.current_transaction in self._jumpdest_count:
self._jumpdest_count[transaction]
try: try:
if self._jumpdest_count[transaction][target] > 3: if self._jumpdest_count[transaction][target] == 4:
state.annotate( state.annotate(
LoopAnnotation(state.get_current_instruction()["address"]) LoopAnnotation(state.get_current_instruction()["address"])
) )
@ -70,7 +69,7 @@ class DOS(DetectionModule):
except KeyError: except KeyError:
self._jumpdest_count[transaction][target] = 0 self._jumpdest_count[transaction][target] = 0
except KeyError: else:
self._jumpdest_count[transaction] = {} self._jumpdest_count[transaction] = {}
self._jumpdest_count[transaction][target] = 0 self._jumpdest_count[transaction][target] = 0

Loading…
Cancel
Save