Skip to content

Commit

Permalink
Improve reentrancy heuristic: ignore call to this. if the destination…
Browse files Browse the repository at this point in the history
… is reentrancy-safe (close #127)
  • Loading branch information
montyly committed Feb 9, 2019
1 parent 0ad0777 commit 02661eb
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion slither/detectors/reentrancy/reentrancy.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"""

from slither.core.cfg.node import NodeType
from slither.core.declarations import Function, SolidityFunction
from slither.core.declarations import Function, SolidityFunction, SolidityVariable
from slither.core.expressions import UnaryOperation, UnaryOperationType
from slither.detectors.abstract_detector import (AbstractDetector,
DetectorClassification)
Expand Down Expand Up @@ -55,6 +55,13 @@ def _can_callback(self, irs):
continue
if isinstance(ir.function, Variable):
continue
# If there is a call to itself
# We can check that the function called is
# reentrancy-safe
if ir.destination == SolidityVariable('this'):
if not ir.function.all_high_level_calls():
if not ir.function.all_low_level_calls():
continue
return True
return False

Expand Down

0 comments on commit 02661eb

Please sign in to comment.