mirror of
https://github.com/github/codeql.git
synced 2025-12-20 10:46:30 +01:00
Address review comments
This commit is contained in:
@@ -4,21 +4,13 @@ private import DataFlowUtil
|
||||
private import semmle.code.java.dataflow.InstanceAccess
|
||||
private import semmle.code.java.dataflow.FlowSummary
|
||||
private import semmle.code.java.dispatch.VirtualDispatch as VirtualDispatch
|
||||
private import semmle.code.java.dataflow.internal.FlowSummaryImplSpecific
|
||||
|
||||
private module DispatchImpl {
|
||||
/** Gets a viable implementation of the target of the given `Call`. */
|
||||
Callable viableCallable(Call c) {
|
||||
result = VirtualDispatch::viableCallable(c)
|
||||
or
|
||||
result = c.getCallee().getSourceDeclaration() and
|
||||
(
|
||||
result instanceof SummarizedCallable
|
||||
or
|
||||
sourceElement(result, _, _)
|
||||
or
|
||||
sinkElement(result, _, _)
|
||||
)
|
||||
result.(SummarizedCallable) = c.getCallee().getSourceDeclaration()
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -712,8 +712,8 @@ module Private {
|
||||
exists(SourceOrSinkElement e |
|
||||
sourceElement(e, output, kind) and
|
||||
if outputNeedsReference(specLast(output))
|
||||
then viableCallable(ref.asCall()) = any(InterpretNode n | n.asElement() = e).asCallable()
|
||||
else ref.asElement() = e
|
||||
then e = ref.getCallTarget()
|
||||
else e = ref.asElement()
|
||||
)
|
||||
}
|
||||
|
||||
@@ -721,8 +721,8 @@ module Private {
|
||||
exists(SourceOrSinkElement e |
|
||||
sinkElement(e, input, kind) and
|
||||
if inputNeedsReference(specLast(input))
|
||||
then viableCallable(ref.asCall()) = any(InterpretNode n | n.asElement() = e).asCallable()
|
||||
else ref.asElement() = e
|
||||
then e = ref.getCallTarget()
|
||||
else e = ref.asElement()
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -125,6 +125,9 @@ class InterpretNode extends TInterpretNode {
|
||||
/** Gets the callable that this node corresponds to, if any. */
|
||||
DataFlowCallable asCallable() { result = this.asElement() }
|
||||
|
||||
/** Gets the target of this call, if any. */
|
||||
Callable getCallTarget() { result = this.asCall().getCallee().getSourceDeclaration() }
|
||||
|
||||
/** Gets a textual representation of this node. */
|
||||
string toString() {
|
||||
result = this.asElement().toString()
|
||||
|
||||
Reference in New Issue
Block a user