Merge pull request #1185 from ConsenSys/fix-balance-overflow

Fix balance overflow
any_name
Bernhard Mueller 5 years ago committed by GitHub
commit 2581f9e238
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 18
      mythril/analysis/solver.py

@ -197,15 +197,21 @@ def _set_minimisation_constraints(
# Minimize # Minimize
minimize.append(transaction.call_data.calldatasize) minimize.append(transaction.call_data.calldatasize)
constraints.append(
UGE(
symbol_factory.BitVecVal(1000000000000000000000, 256),
world_state.starting_balances[transaction.caller],
)
)
for account in world_state.accounts.values(): for account in world_state.accounts.values():
# Lazy way to prevent overflows and to ensure "reasonable" balances # Lazy way to prevent overflows and to ensure "reasonable" balances
# Each account starts with less than 100 ETH # Each account starts with less than 100 ETH
if account.address.symbolic: constraints.append(
constraints.append( UGE(
UGE( symbol_factory.BitVecVal(100000000000000000000, 256),
symbol_factory.BitVecVal(100000000000000000000, 256), world_state.starting_balances[account.address],
world_state.starting_balances[account.address],
)
) )
)
return constraints, tuple(minimize) return constraints, tuple(minimize)

Loading…
Cancel
Save