consider constants in divide-before-multiply

hash was implemented for constants in https://github.com/crytic/slither/pull/1347
pull/1641/head
alpharush 2 years ago committed by GitHub
parent 4c976d5af5
commit 4e8066c711
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      slither/detectors/statements/divide_before_multiply.py

@ -64,8 +64,7 @@ def _explore(to_explore, f_results, divisions): # pylint: disable=too-many-bran
node_results = [] node_results = []
for ir in node.irs: for ir in node.irs:
# check for Constant, has its not hashable (TODO: make Constant hashable) if isinstance(ir, Assignment):
if isinstance(ir, Assignment) and not isinstance(ir.rvalue, Constant):
if ir.rvalue in divisions: if ir.rvalue in divisions:
# Avoid dupplicate. We dont use set so we keep the order of the nodes # Avoid dupplicate. We dont use set so we keep the order of the nodes
if node not in divisions[ir.rvalue]: if node not in divisions[ir.rvalue]:

Loading…
Cancel
Save