Skip to content

Commit db0591a

Browse files
authored
Merge pull request #2708 from crytic/dev
Sync Master <> Dev
2 parents bf32d2f + eabac0a commit db0591a

15 files changed

+65
-16
lines changed

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
description="Slither is a Solidity and Vyper static analysis framework written in Python 3.",
99
url="https://github.com/crytic/slither",
1010
author="Trail of Bits",
11-
version="0.11.1",
11+
version="0.11.2",
1212
packages=find_packages(),
1313
python_requires=">=3.8",
1414
install_requires=[

slither/core/cfg/node.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1011,7 +1011,13 @@ def _update_write_using_ssa(self, ir: Operation) -> None:
10111011
candidates = [var]
10121012

10131013
# If we write to a storage pointer, add everything it points to as target
1014-
if isinstance(var, LocalIRVariable) and var.is_storage:
1014+
# if it's a variable declaration we do not want to consider the right variable written in that case
1015+
# string storage ss = s; // s is a storage variable but should not be considered written at that point
1016+
if (
1017+
isinstance(var, LocalIRVariable)
1018+
and var.is_storage
1019+
and ir.node.type is not NodeType.VARIABLE
1020+
):
10151021
candidates += var.refers_to
10161022

10171023
for var in candidates:

tests/e2e/detectors/snapshots/detectors__detector_ReentrancyEth_0_4_25_DAO_sol__0.txt

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
Reentrancy in TokenCreation.refund() (tests/e2e/detectors/test_data/reentrancy-eth/0.4.25/DAO.sol#318-332):
2+
External calls:
3+
- extraBalance.balance >= extraBalance.accumulatedInput() (tests/e2e/detectors/test_data/reentrancy-eth/0.4.25/DAO.sol#321)
4+
- extraBalance.payOut(address(this),extraBalance.accumulatedInput()) (tests/e2e/detectors/test_data/reentrancy-eth/0.4.25/DAO.sol#322)
5+
- msg.sender.call.value(weiGiven[msg.sender])() (tests/e2e/detectors/test_data/reentrancy-eth/0.4.25/DAO.sol#325)
6+
External calls sending eth:
7+
- msg.sender.call.value(weiGiven[msg.sender])() (tests/e2e/detectors/test_data/reentrancy-eth/0.4.25/DAO.sol#325)
8+
State variables written after the call(s):
9+
- weiGiven[msg.sender] = 0 (tests/e2e/detectors/test_data/reentrancy-eth/0.4.25/DAO.sol#329)
10+
TokenCreationInterface.weiGiven (tests/e2e/detectors/test_data/reentrancy-eth/0.4.25/DAO.sol#251) can be used in cross function reentrancies:
11+
- TokenCreation.createTokenProxy(address) (tests/e2e/detectors/test_data/reentrancy-eth/0.4.25/DAO.sol#299-316)
12+
- TokenCreation.refund() (tests/e2e/detectors/test_data/reentrancy-eth/0.4.25/DAO.sol#318-332)
13+
114
Reentrancy in DAO.executeProposal(uint256,bytes) (tests/e2e/detectors/test_data/reentrancy-eth/0.4.25/DAO.sol#853-937):
215
External calls:
316
- ! isRecipientAllowed(p.recipient) (tests/e2e/detectors/test_data/reentrancy-eth/0.4.25/DAO.sol#881)
@@ -21,7 +34,6 @@ Reentrancy in DAO.executeProposal(uint256,bytes) (tests/e2e/detectors/test_data/
2134
- DAO.splitDAO(uint256,address) (tests/e2e/detectors/test_data/reentrancy-eth/0.4.25/DAO.sol#947-1020)
2235
- DAO.vote(uint256,bool) (tests/e2e/detectors/test_data/reentrancy-eth/0.4.25/DAO.sol#820-850)
2336
- closeProposal(_proposalID) (tests/e2e/detectors/test_data/reentrancy-eth/0.4.25/DAO.sol#933)
24-
- p = proposals[_proposalID] (tests/e2e/detectors/test_data/reentrancy-eth/0.4.25/DAO.sol#941)
2537
- p.open = false (tests/e2e/detectors/test_data/reentrancy-eth/0.4.25/DAO.sol#944)
2638
DAOInterface.proposals (tests/e2e/detectors/test_data/reentrancy-eth/0.4.25/DAO.sol#394) can be used in cross function reentrancies:
2739
- DAO.DAO(address,DAO_Creator,uint256,uint256,uint256,address) (tests/e2e/detectors/test_data/reentrancy-eth/0.4.25/DAO.sol#702-726)
@@ -58,16 +70,3 @@ Reentrancy in DAO.executeProposal(uint256,bytes) (tests/e2e/detectors/test_data/
5870
- DAO.retrieveDAOReward(bool) (tests/e2e/detectors/test_data/reentrancy-eth/0.4.25/DAO.sol#1037-1057)
5971
- DAOInterface.totalRewardToken (tests/e2e/detectors/test_data/reentrancy-eth/0.4.25/DAO.sol#412)
6072

61-
Reentrancy in TokenCreation.refund() (tests/e2e/detectors/test_data/reentrancy-eth/0.4.25/DAO.sol#318-332):
62-
External calls:
63-
- extraBalance.balance >= extraBalance.accumulatedInput() (tests/e2e/detectors/test_data/reentrancy-eth/0.4.25/DAO.sol#321)
64-
- extraBalance.payOut(address(this),extraBalance.accumulatedInput()) (tests/e2e/detectors/test_data/reentrancy-eth/0.4.25/DAO.sol#322)
65-
- msg.sender.call.value(weiGiven[msg.sender])() (tests/e2e/detectors/test_data/reentrancy-eth/0.4.25/DAO.sol#325)
66-
External calls sending eth:
67-
- msg.sender.call.value(weiGiven[msg.sender])() (tests/e2e/detectors/test_data/reentrancy-eth/0.4.25/DAO.sol#325)
68-
State variables written after the call(s):
69-
- weiGiven[msg.sender] = 0 (tests/e2e/detectors/test_data/reentrancy-eth/0.4.25/DAO.sol#329)
70-
TokenCreationInterface.weiGiven (tests/e2e/detectors/test_data/reentrancy-eth/0.4.25/DAO.sol#251) can be used in cross function reentrancies:
71-
- TokenCreation.createTokenProxy(address) (tests/e2e/detectors/test_data/reentrancy-eth/0.4.25/DAO.sol#299-316)
72-
- TokenCreation.refund() (tests/e2e/detectors/test_data/reentrancy-eth/0.4.25/DAO.sol#318-332)
73-

tests/e2e/detectors/snapshots/detectors__detector_UninitializedStateVarsDetection_0_4_25_uninitialized_sol__0.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
Test3.s (tests/e2e/detectors/test_data/uninitialized-state/0.4.25/uninitialized.sol#61) is never initialized. It is used in:
2+
- Test3.a() (tests/e2e/detectors/test_data/uninitialized-state/0.4.25/uninitialized.sol#63-65)
3+
14
Test2.st (tests/e2e/detectors/test_data/uninitialized-state/0.4.25/uninitialized.sol#45) is never initialized. It is used in:
25
- Test2.use() (tests/e2e/detectors/test_data/uninitialized-state/0.4.25/uninitialized.sol#53-56)
36

tests/e2e/detectors/snapshots/detectors__detector_UninitializedStateVarsDetection_0_5_16_uninitialized_sol__0.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
Test3.s (tests/e2e/detectors/test_data/uninitialized-state/0.5.16/uninitialized.sol#61) is never initialized. It is used in:
2+
- Test3.a() (tests/e2e/detectors/test_data/uninitialized-state/0.5.16/uninitialized.sol#63-65)
3+
14
Test2.st (tests/e2e/detectors/test_data/uninitialized-state/0.5.16/uninitialized.sol#45) is never initialized. It is used in:
25
- Test2.use() (tests/e2e/detectors/test_data/uninitialized-state/0.5.16/uninitialized.sol#53-56)
36

tests/e2e/detectors/snapshots/detectors__detector_UninitializedStateVarsDetection_0_6_11_uninitialized_sol__0.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
Test3.s (tests/e2e/detectors/test_data/uninitialized-state/0.6.11/uninitialized.sol#61) is never initialized. It is used in:
2+
- Test3.a() (tests/e2e/detectors/test_data/uninitialized-state/0.6.11/uninitialized.sol#63-65)
3+
14
Test2.st (tests/e2e/detectors/test_data/uninitialized-state/0.6.11/uninitialized.sol#45) is never initialized. It is used in:
25
- Test2.use() (tests/e2e/detectors/test_data/uninitialized-state/0.6.11/uninitialized.sol#53-56)
36

tests/e2e/detectors/snapshots/detectors__detector_UninitializedStateVarsDetection_0_7_6_uninitialized_sol__0.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
Test3.s (tests/e2e/detectors/test_data/uninitialized-state/0.7.6/uninitialized.sol#61) is never initialized. It is used in:
2+
- Test3.a() (tests/e2e/detectors/test_data/uninitialized-state/0.7.6/uninitialized.sol#63-65)
3+
14
Test2.st (tests/e2e/detectors/test_data/uninitialized-state/0.7.6/uninitialized.sol#45) is never initialized. It is used in:
25
- Test2.use() (tests/e2e/detectors/test_data/uninitialized-state/0.7.6/uninitialized.sol#53-56)
36

tests/e2e/detectors/test_data/uninitialized-state/0.4.25/uninitialized.sol

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,11 @@ contract Test2 {
5656
}
5757

5858
}
59+
60+
contract Test3 {
61+
string s;
62+
63+
function a() public {
64+
string storage ss = s;
65+
}
66+
}

tests/e2e/detectors/test_data/uninitialized-state/0.5.16/uninitialized.sol

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,11 @@ contract Test2 {
5656
}
5757

5858
}
59+
60+
contract Test3 {
61+
string s;
62+
63+
function a() public {
64+
string storage ss = s;
65+
}
66+
}

tests/e2e/detectors/test_data/uninitialized-state/0.6.11/uninitialized.sol

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,11 @@ contract Test2 {
5656
}
5757

5858
}
59+
60+
contract Test3 {
61+
string s;
62+
63+
function a() public {
64+
string storage ss = s;
65+
}
66+
}

tests/e2e/detectors/test_data/uninitialized-state/0.7.6/uninitialized.sol

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,11 @@ contract Test2 {
5656
}
5757

5858
}
59+
60+
contract Test3 {
61+
string s;
62+
63+
function a() public {
64+
string storage ss = s;
65+
}
66+
}
Binary file not shown.

0 commit comments

Comments
 (0)