Merge pull request #1496 from markshannon/python-uninitial-local-fix

Python: Don't report uninitialized locals in unreachable code.
This commit is contained in:
Taus
2019-06-27 16:00:07 +02:00
committed by GitHub

View File

@@ -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)
)