diff --git a/slither/detectors/attributes/old_solc.py b/slither/detectors/attributes/old_solc.py index 4596d7df9..9213d397a 100644 --- a/slither/detectors/attributes/old_solc.py +++ b/slither/detectors/attributes/old_solc.py @@ -147,7 +147,7 @@ class OldSolc(AbstractDetector): :return: Returns True if the range can encapsulate any possible value, False if it is an invalid range. """ return self.lower < self.upper or \ - (self.lower == self.upper and (self.lower_inclusive or self.upper_inclusive)) + (self.lower == self.upper and (self.lower_inclusive and self.upper_inclusive)) @property diff --git a/tests/old_solc.sol b/tests/old_solc.sol index 291d4c96a..ea93a41be 100644 --- a/tests/old_solc.sol +++ b/tests/old_solc.sol @@ -1,4 +1,6 @@ -pragma solidity 0.4.21; +// The version pragma below should get flagged by the detector +// Reason: The expression "^0.4.0 >0.4.2" allows old solc (<0.4.23) +pragma solidity ^0.5.22 || 0.4.23 - 0.4.24 || ^0.4.0 >0.4.2 || ~0.0.0 ^0.5.0 <= 0.5.50 || > 0.7.0; contract Contract{