Skip to content

Commit 13027a1

Browse files
author
Stephan Brandauer
committed
Java: review suggestions from @atorralba
1 parent 2f2f507 commit 13027a1

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

java/ql/src/Telemetry/AutomodelApplicationModeCharacteristics.qll

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,17 @@ newtype JavaRelatedLocationType = CallContext()
2525
* A class representing nodes that are arguments to calls.
2626
*/
2727
private class ArgumentNode extends DataFlow::Node {
28-
ArgumentNode() { this.asExpr() = [any(Call c).getAnArgument(), any(Call c).getQualifier()] }
28+
Call c;
29+
30+
ArgumentNode() {
31+
exists(Argument arg | this.asExpr() = arg and not arg.isVararg() and c = arg.getCall())
32+
or
33+
this.(DataFlow::ImplicitVarargsArray).getCall() = c
34+
or
35+
this = DataFlow::getInstanceArgument(c)
36+
}
37+
38+
Call getCall() { result = c }
2939
}
3040

3141
/**
@@ -325,10 +335,9 @@ private class OtherArgumentToModeledMethodCharacteristic extends Characteristics
325335

326336
override predicate appliesToEndpoint(Endpoint e) {
327337
not ApplicationCandidatesImpl::isSink(e, _, _) and
328-
exists(DataFlow::Node otherSink, Call c |
338+
exists(Endpoint otherSink |
329339
ApplicationCandidatesImpl::isSink(otherSink, _, "manual") and
330-
c = otherSink.asExpr().(Argument).getCall() and
331-
e.asExpr() in [c.getQualifier(), c.getAnArgument()] and
340+
e.getCall() = otherSink.getCall() and
332341
e != otherSink
333342
)
334343
}

0 commit comments

Comments
 (0)