mirror of
https://github.com/github/codeql.git
synced 2026-04-30 11:15:13 +02:00
Capture flow: Take overwrites in nested scopes into account
This commit is contained in:
@@ -232,6 +232,9 @@ signature module OutputSig<LocationSig Location, InputSig<Location> I> {
|
||||
|
||||
/** Holds if this-to-this summaries are expected for `c`. */
|
||||
predicate heuristicAllowInstanceParameterReturnInSelf(I::Callable c);
|
||||
|
||||
/** Holds if captured variable `v` is cleared at `node`. */
|
||||
predicate clearsContent(ClosureNode node, I::CapturedVariable v);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -959,4 +962,11 @@ module Flow<LocationSig Location, InputSig<Location> Input> implements OutputSig
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
predicate clearsContent(ClosureNode node, CapturedVariable v) {
|
||||
exists(BasicBlock bb, int i |
|
||||
captureWrite(v, bb, i, false, _) and
|
||||
node = TSynthThisQualifier(bb, i, false)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user