Rust: Fix the false positives.

This commit is contained in:
Geoffrey White
2025-12-04 17:12:38 +00:00
parent 8594c7a29a
commit 32e9fdfe19
3 changed files with 9 additions and 4 deletions

View File

@@ -99,11 +99,17 @@ module AccessAfterLifetime {
// `b` is a child of `a`
a = b.getEnclosingBlock*()
or
// propagate through function calls
// propagate through function calls (static target)
exists(CallExprBase ce |
mayEncloseOnStack(a, ce.getEnclosingBlock()) and
ce.getStaticTarget() = b.getEnclosingCallable()
)
or
// propagate through function calls (runtime target)
exists(Call c |
mayEncloseOnStack(a, c.getEnclosingBlock()) and
c.getARuntimeTarget() = b.getEnclosingCallable()
)
}
/**