Skip to content

Commit 0ae8b69

Browse files
committed
Python: Prevent joining on scope in PointsToContext::appliesTo
One of those cases where I _wish_ `pragma[inline]` also meant "don't join on the stuff inside this predicate -- it's inlined for a reason". Unsurprisingly, joining on the scope first works poorly.
1 parent 28d6cad commit 0ae8b69

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

python/ql/src/semmle/python/pointsto/PointsToContext.qll

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,11 @@ class PointsToContext extends TPointsToContext {
184184

185185
/** Holds if this context can apply to the CFG node `n`. */
186186
pragma[inline]
187-
predicate appliesTo(ControlFlowNode n) { this.appliesToScope(n.getScope()) }
187+
predicate appliesTo(ControlFlowNode n) {
188+
exists(Scope s |
189+
this.appliesToScope(pragma[only_bind_into](s)) and pragma[only_bind_into](s) = n.getScope()
190+
)
191+
}
188192

189193
/** Holds if this context is a call context. */
190194
predicate isCall() { this = TCallContext(_, _, _) }

0 commit comments

Comments
 (0)