Skip to content

Commit c0ff67b

Browse files
authored
Merge pull request #1496 from markshannon/python-uninitial-local-fix
Python: Don't report uninitialized locals in unreachable code.
2 parents c4cb75e + 7bbe39e commit c0ff67b

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

python/ql/src/Variables/UninitializedLocal.ql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
import python
1414
import Undefined
15-
15+
import semmle.python.pointsto.PointsTo
1616

1717
predicate uninitialized_local(NameNode use) {
1818
exists(FastLocalVariable local |
@@ -21,7 +21,7 @@ predicate uninitialized_local(NameNode use) {
2121
)
2222
and
2323
(
24-
any(Uninitialized uninit).taints(use)
24+
any(Uninitialized uninit).taints(use) and PointsToInternal::reachableBlock(use.getBasicBlock(), _)
2525
or
2626
not exists(EssaVariable var | var.getASourceUse() = use)
2727
)

0 commit comments

Comments
 (0)