mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
Python: Don't report uninitialized locals in unreachable code.
This commit is contained in:
@@ -12,7 +12,7 @@
|
||||
|
||||
import python
|
||||
import Undefined
|
||||
|
||||
import semmle.python.pointsto.PointsTo
|
||||
|
||||
predicate uninitialized_local(NameNode use) {
|
||||
exists(FastLocalVariable local |
|
||||
@@ -21,7 +21,7 @@ predicate uninitialized_local(NameNode use) {
|
||||
)
|
||||
and
|
||||
(
|
||||
any(Uninitialized uninit).taints(use)
|
||||
any(Uninitialized uninit).taints(use) and PointsToInternal::reachableBlock(use.getBasicBlock(), _)
|
||||
or
|
||||
not exists(EssaVariable var | var.getASourceUse() = use)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user