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
classFoo:
deffoo(self, a, b, c=0):
start=0visible=not (a==bandc)
end=startifvisibleelseNonereturnend
CodeQL Version: 2.18.3
Alert : Local variable 'visible' may be used before it is initialized.
I suspect that the issue is caused by EssaVariable being unable to locate the assignment statement for the variable visible, but I'm not sure how to modify the ql statement.
The text was updated successfully, but these errors were encountered:
We conducted some experiments and found that the issue is likely not with the inline if-then-else statement, but rather with the UnaryExpr. Whenever a local variable assignment statement takes the form of a = not (b == c and d), it results in an FP case. However, a BoolExpr like a == b does not cause this issue.
I plan to use a brute-force approach to filter out such cases.
predicate ignore_UnaryExpr(NameNode u) {
not exists(AssignStmt ass |
ass.getScope() = u.getScope() and
ass.getATarget().toString() = u.getId() and
ass.getValue().toString() = "UnaryExpr"
)
}
from NameNode u
where uninitialized_local(u) and not explicitly_guarded(u) and ignore_UnaryExpr(u)
select u.getNode(), u.getId()
Description of the false positive
Code samples or links to source code
CodeQL Version: 2.18.3
Alert : Local variable 'visible' may be used before it is initialized.
I suspect that the issue is caused by EssaVariable being unable to locate the assignment statement for the variable visible, but I'm not sure how to modify the ql statement.
The text was updated successfully, but these errors were encountered: