Python: Remove points-to from Expr

This commit is contained in:
Taus
2025-10-30 11:52:39 +00:00
parent b434ce460e
commit b93ce98612
35 changed files with 164 additions and 119 deletions

View File

@@ -11,6 +11,7 @@
*/
import python
private import LegacyPointsTo
import Variables.MonkeyPatched
import Loop
import semmle.python.pointsto.PointsTo
@@ -95,7 +96,7 @@ predicate undefined_use(Name u) {
not contains_unknown_import_star(u.getEnclosingModule()) and
not use_of_exec(u.getEnclosingModule()) and
not exists(u.getVariable().getAStore()) and
not u.pointsTo(_) and
not u.(ExprWithPointsTo).pointsTo(_) and
not probably_defined_in_loop(u)
}

View File

@@ -12,6 +12,7 @@
*/
import python
private import LegacyPointsTo
import Undefined
import semmle.python.pointsto.PointsTo
@@ -30,7 +31,7 @@ predicate uninitialized_local(NameNode use) {
predicate explicitly_guarded(NameNode u) {
exists(Try t |
t.getBody().contains(u.getNode()) and
t.getAHandler().getType().pointsTo(ClassValue::nameError())
t.getAHandler().getType().(ExprWithPointsTo).pointsTo(ClassValue::nameError())
)
}