Fix mutable default arg definitions

pull/554/head
Dominik Muhs 6 years ago
parent ef7257a1c3
commit ba34b3629c
  1. 5
      mythril/analysis/modules/external_calls.py
  2. 5
      mythril/analysis/modules/integer.py
  3. 4
      mythril/laser/ethereum/state.py
  4. 4
      mythril/laser/ethereum/taint_analysis.py
  5. 4
      mythril/mythril.py

@ -16,8 +16,9 @@ Check for call.value()() to external addresses
MAX_SEARCH_DEPTH = 64
def search_children(statespace, node, start_index=0, depth=0, results=[]):
def search_children(statespace, node, start_index=0, depth=0, results=None):
if results is None:
results = []
logging.debug("SEARCHING NODE %d", node.uid)
if depth < MAX_SEARCH_DEPTH:

@ -214,7 +214,7 @@ def _check_sstore(state, taint_result):
return taint_result.check(state, -2)
def _search_children(statespace, node, expression, taint_result=None, constraint=[], index=0, depth=0, max_depth=64):
def _search_children(statespace, node, expression, taint_result=None, constraint=None, index=0, depth=0, max_depth=64):
"""
Checks the statespace for children states, with JUMPI or SSTORE instuctions,
for dependency on expression
@ -227,6 +227,9 @@ def _search_children(statespace, node, expression, taint_result=None, constraint
:param max_depth: Max depth to explore
:return: List of states that match the opcodes and are dependent on expression
"""
if constraint is None:
constraint = []
logging.debug("SEARCHING NODE for usage of an overflowed variable %d", node.uid)
if taint_result is None:

@ -135,8 +135,10 @@ class MachineStack(list):
"""
STACK_LIMIT = 1024
def __init__(self, default_list=[]):
def __init__(self, default_list=None):
super(MachineStack, self).__init__(default_list)
if default_list is None:
default_list = []
def append(self, element):
"""

@ -82,7 +82,7 @@ class TaintRunner:
"""
@staticmethod
def execute(statespace, node, state, initial_stack=[]):
def execute(statespace, node, state, initial_stack=None):
"""
Runs taint analysis on the statespace
:param statespace: symbolic statespace to run taint analysis on
@ -91,6 +91,8 @@ class TaintRunner:
:param stack_indexes: stack indexes to introduce taint
:return: TaintResult object containing analysis results
"""
if initial_stack is None:
initial_stack = []
result = TaintResult()
transaction_stack_length = len(node.states[0].transaction_stack)
# Build initial current_node

@ -382,7 +382,9 @@ class Mythril(object):
return report
def get_state_variable_from_storage(self, address, params=[]):
def get_state_variable_from_storage(self, address, params=None):
if params is None:
params = []
(position, length, mappings) = (0, 1, [])
try:
if params[0] == "mapping":

Loading…
Cancel
Save