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