You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Running slither on the provided code example produces a false positive regarding an uninitialized local variable.
The slither parser renames variables so that multiple declarations in the same function don't have the same name. Printing the IR of the provided code example shows that in the second branch, the returned identifier is renamed to q_scope_0 while the identifier in the declaration remains q. The declaration identifier should have been renamed to q_scope_0. I think the solution to this might be to copy the id field from the json asthere so that it can be used for renaming lookup.
Code example to reproduce the issue:
pragma solidity 0.8.13;
contract Test
{
function f1() public view returns (int, string memory) {
return (0,"hello");
}
function f2(bool a) public view returns (string memory) {
if (a) {
(int x, string memory z) = f1();
return z;
} else {
(int x, string memory z) = f1();
return z;
}
}
}
Version:
0.9.1
Relevant log output:
Test.f2(bool).q_scope_0 (test.sol#15) is a local variable never initialized
Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#uninitialized-local-variables
The text was updated successfully, but these errors were encountered:
0xalpharush
changed the title
[Bug-Candidate]: uninitialized-local-variables FP in destructuring assignment
[Bug]: uninitialized-local-variables FP in destructuring assignment
Feb 24, 2023
Describe the issue:
Running slither on the provided code example produces a false positive regarding an uninitialized local variable.
The slither parser renames variables so that multiple declarations in the same function don't have the same name. Printing the IR of the provided code example shows that in the second branch, the returned identifier is renamed to
q_scope_0
while the identifier in the declaration remainsq
. The declaration identifier should have been renamed toq_scope_0
. I think the solution to this might be to copy theid
field from the jsonast
here so that it can be used for renaming lookup.Code example to reproduce the issue:
Version:
0.9.1
Relevant log output:
Test.f2(bool).q_scope_0 (test.sol#15) is a local variable never initialized Reference: https://github.com/crytic/slither/wiki/Detector-Documentation#uninitialized-local-variables
The text was updated successfully, but these errors were encountered: