mirror of
https://github.com/github/codeql.git
synced 2026-04-28 10:15:14 +02:00
Java: Fix tests.
This commit is contained in:
@@ -115,12 +115,12 @@ public class B {
|
||||
}
|
||||
{
|
||||
// "java.util;Map;true;computeIfAbsent;;;ReturnValue of Argument[1];ReturnValue;value",
|
||||
Object out = ((Map)null).computeIfAbsent(null,k -> source()); sink(out);
|
||||
Object out = ((Map)null).computeIfAbsent(null,k -> source()); sink(out); // $ hasValueFlow
|
||||
}
|
||||
{
|
||||
// "java.util;Map;true;computeIfAbsent;;;ReturnValue of Argument[1];MapValue of Argument[-1];value",
|
||||
Map out = null;
|
||||
out.computeIfAbsent(null,k -> source()); sink(readMapValue(out));
|
||||
out.computeIfAbsent(null,k -> source()); sink(readMapValue(out)); // $ hasValueFlow
|
||||
}
|
||||
{
|
||||
// "java.util;Map;true;entrySet;;;MapValue of Argument[-1];MapValue of Element of ReturnValue;value",
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import semmle.code.java.dataflow.DataFlow
|
||||
import semmle.code.java.dataflow.internal.DataFlowPrivate
|
||||
import semmle.code.java.dataflow.internal.TaintTrackingUtil
|
||||
import semmle.code.java.dataflow.internal.DataFlowNodes::Private
|
||||
import semmle.code.java.dataflow.internal.FlowSummaryImpl as FlowSummaryImpl
|
||||
@@ -24,13 +25,16 @@ where
|
||||
exists(ArgumentNode arg, MethodAccess call, DataFlow::ParameterNode p, int i |
|
||||
src = arg and
|
||||
p.isParameterOf(call.getMethod().getSourceDeclaration(), i) and
|
||||
arg.argumentOf(call, i)
|
||||
arg.argumentOf(any(DataFlowCall c | c.asCall() = call), i)
|
||||
|
|
||||
sink.asExpr() = call and
|
||||
taintFlowThrough(p)
|
||||
or
|
||||
exists(DataFlow::ParameterNode p2, int j |
|
||||
sink.(DataFlow::PostUpdateNode).getPreUpdateNode().(ArgumentNode).argumentOf(call, j) and
|
||||
sink.(DataFlow::PostUpdateNode)
|
||||
.getPreUpdateNode()
|
||||
.(ArgumentNode)
|
||||
.argumentOf(any(DataFlowCall c | c.asCall() = call), j) and
|
||||
taintFlowUpdate(p, p2) and
|
||||
p2.isParameterOf(_, j)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user