Skip to content

Commit e711ba9

Browse files
committed
Dataflow: Remove negation materialization.
1 parent 39e3254 commit e711ba9

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

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

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1230,6 +1230,11 @@ private module Stage2 {
12301230
callMayFlowThroughFwd(call, pragma[only_bind_into](config))
12311231
}
12321232

1233+
pragma[nomagic]
1234+
private predicate returnNodeMayFlowThrough(RetNodeEx ret, Ap ap, Configuration config) {
1235+
fwdFlow(ret, any(CcCall ccc), apSome(_), ap, config)
1236+
}
1237+
12331238
/**
12341239
* Holds if `node` with access path `ap` is part of a path from a source to a
12351240
* sink in the configuration `config`.
@@ -1306,7 +1311,7 @@ private module Stage2 {
13061311
// flow out of a callable
13071312
revFlowOut(_, node, _, _, ap, config) and
13081313
toReturn = true and
1309-
if fwdFlow(node, any(CcCall ccc), apSome(_), ap, config)
1314+
if returnNodeMayFlowThrough(node, ap, config)
13101315
then returnAp = apSome(ap)
13111316
else returnAp = apNone()
13121317
}
@@ -1925,6 +1930,11 @@ private module Stage3 {
19251930
callMayFlowThroughFwd(call, pragma[only_bind_into](config))
19261931
}
19271932

1933+
pragma[nomagic]
1934+
private predicate returnNodeMayFlowThrough(RetNodeEx ret, Ap ap, Configuration config) {
1935+
fwdFlow(ret, any(CcCall ccc), apSome(_), ap, config)
1936+
}
1937+
19281938
/**
19291939
* Holds if `node` with access path `ap` is part of a path from a source to a
19301940
* sink in the configuration `config`.
@@ -2001,7 +2011,7 @@ private module Stage3 {
20012011
// flow out of a callable
20022012
revFlowOut(_, node, _, _, ap, config) and
20032013
toReturn = true and
2004-
if fwdFlow(node, any(CcCall ccc), apSome(_), ap, config)
2014+
if returnNodeMayFlowThrough(node, ap, config)
20052015
then returnAp = apSome(ap)
20062016
else returnAp = apNone()
20072017
}
@@ -2691,6 +2701,11 @@ private module Stage4 {
26912701
callMayFlowThroughFwd(call, pragma[only_bind_into](config))
26922702
}
26932703

2704+
pragma[nomagic]
2705+
private predicate returnNodeMayFlowThrough(RetNodeEx ret, Ap ap, Configuration config) {
2706+
fwdFlow(ret, any(CcCall ccc), apSome(_), ap, config)
2707+
}
2708+
26942709
/**
26952710
* Holds if `node` with access path `ap` is part of a path from a source to a
26962711
* sink in the configuration `config`.
@@ -2767,7 +2782,7 @@ private module Stage4 {
27672782
// flow out of a callable
27682783
revFlowOut(_, node, _, _, ap, config) and
27692784
toReturn = true and
2770-
if fwdFlow(node, any(CcCall ccc), apSome(_), ap, config)
2785+
if returnNodeMayFlowThrough(node, ap, config)
27712786
then returnAp = apSome(ap)
27722787
else returnAp = apNone()
27732788
}

0 commit comments

Comments
 (0)