Skip to content

Commit ab86227

Browse files
committed
Java: Fix tests.
1 parent 12aeaee commit ab86227

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

java/ql/test/library-tests/dataflow/collections/B.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,12 @@ void foo() throws InterruptedException {
115115
}
116116
{
117117
// "java.util;Map;true;computeIfAbsent;;;ReturnValue of Argument[1];ReturnValue;value",
118-
Object out = ((Map)null).computeIfAbsent(null,k -> source()); sink(out);
118+
Object out = ((Map)null).computeIfAbsent(null,k -> source()); sink(out); // $ hasValueFlow
119119
}
120120
{
121121
// "java.util;Map;true;computeIfAbsent;;;ReturnValue of Argument[1];MapValue of Argument[-1];value",
122122
Map out = null;
123-
out.computeIfAbsent(null,k -> source()); sink(readMapValue(out));
123+
out.computeIfAbsent(null,k -> source()); sink(readMapValue(out)); // $ hasValueFlow
124124
}
125125
{
126126
// "java.util;Map;true;entrySet;;;MapValue of Argument[-1];MapValue of Element of ReturnValue;value",

java/ql/test/library-tests/dataflow/local-additional-taint/localAdditionalTaintStep.ql

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import semmle.code.java.dataflow.DataFlow
2+
import semmle.code.java.dataflow.internal.DataFlowPrivate
23
import semmle.code.java.dataflow.internal.TaintTrackingUtil
34
import semmle.code.java.dataflow.internal.DataFlowNodes::Private
45
import semmle.code.java.dataflow.internal.FlowSummaryImpl as FlowSummaryImpl
@@ -24,13 +25,16 @@ where
2425
exists(ArgumentNode arg, MethodAccess call, DataFlow::ParameterNode p, int i |
2526
src = arg and
2627
p.isParameterOf(call.getMethod().getSourceDeclaration(), i) and
27-
arg.argumentOf(call, i)
28+
arg.argumentOf(any(DataFlowCall c | c.asCall() = call), i)
2829
|
2930
sink.asExpr() = call and
3031
taintFlowThrough(p)
3132
or
3233
exists(DataFlow::ParameterNode p2, int j |
33-
sink.(DataFlow::PostUpdateNode).getPreUpdateNode().(ArgumentNode).argumentOf(call, j) and
34+
sink.(DataFlow::PostUpdateNode)
35+
.getPreUpdateNode()
36+
.(ArgumentNode)
37+
.argumentOf(any(DataFlowCall c | c.asCall() = call), j) and
3438
taintFlowUpdate(p, p2) and
3539
p2.isParameterOf(_, j)
3640
)

0 commit comments

Comments
 (0)