Improve reentrancy heuristic: Only skip view/pure/variable calls if Solidity 0.5 is used

pull/172/head
Josselin 6 years ago
parent ea599c4efd
commit d22e53fdfe
  1. 5
      slither/detectors/reentrancy/reentrancy.py

@ -34,8 +34,7 @@ class Reentrancy(AbstractDetector):
KEY = 'REENTRANCY'
@staticmethod
def _can_callback(irs):
def _can_callback(self, irs):
"""
Detect if the node contains a call that can
be used to re-entrance
@ -50,6 +49,8 @@ class Reentrancy(AbstractDetector):
if isinstance(ir, LowLevelCall):
return True
if isinstance(ir, HighLevelCall) and not isinstance(ir, LibraryCall):
# If solidity >0.5, STATICCALL is used
if self.slither.solc_version and self.slither.solc_version.startswith('0.5.'):
if isinstance(ir.function, Function) and (ir.function.view or ir.function.pure):
continue
if isinstance(ir.function, Variable):

Loading…
Cancel
Save