Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b0f0f89

Browse files
committed
Dataflow: Minor pruning improvements.
1 parent 27fc610 commit b0f0f89

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

java/ql/src/semmle/code/java/dataflow/internal/DataFlowImpl.qll

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,7 @@ private predicate nodeCand1(Node node, Configuration config) { nodeCand1(node, _
535535

536536
private predicate throughFlowNodeCand1(Node node, Configuration config) {
537537
nodeCand1(node, true, config) and
538+
nodeCandFwd1(node, true, config) and
538539
not fullBarrier(node, config) and
539540
not inBarrier(node, config) and
540541
not outBarrier(node, config)
@@ -2045,23 +2046,25 @@ private predicate flow(Node n, Configuration config) { flow(n, _, _, _, config)
20452046

20462047
pragma[noinline]
20472048
private predicate parameterFlow(
2048-
ParameterNode p, AccessPathApprox apa, DataFlowCallable c, Configuration config
2049+
ParameterNode p, AccessPathApprox apa, AccessPathApprox apa0, DataFlowCallable c,
2050+
Configuration config
20492051
) {
2050-
flow(p, true, _, apa, config) and
2052+
flow(p, true, TAccessPathApproxSome(apa0), apa, config) and
20512053
c = p.getEnclosingCallable()
20522054
}
20532055

2054-
private predicate parameterMayFlowThrough(ParameterNode p, AccessPathApprox apa) {
2056+
private predicate parameterMayFlowThrough(ParameterNode p, DataFlowCallable c, AccessPathApprox apa) {
20552057
exists(ReturnNodeExt ret, Configuration config, AccessPathApprox apa0 |
2056-
parameterFlow(p, apa, ret.getEnclosingCallable(), config) and
2058+
parameterFlow(p, apa, apa0, c, config) and
2059+
c = ret.getEnclosingCallable() and
20572060
flow(ret, true, TAccessPathApproxSome(_), apa0, config) and
20582061
flowFwd(ret, any(CallContextCall ccc), TAccessPathApproxSome(apa), _, apa0, config)
20592062
)
20602063
}
20612064

20622065
private newtype TSummaryCtx =
20632066
TSummaryCtxNone() or
2064-
TSummaryCtxSome(ParameterNode p, AccessPath ap) { parameterMayFlowThrough(p, ap.getApprox()) }
2067+
TSummaryCtxSome(ParameterNode p, AccessPath ap) { parameterMayFlowThrough(p, _, ap.getApprox()) }
20652068

20662069
/**
20672070
* A context for generating flow summaries. This represents flow entry through

0 commit comments

Comments
 (0)