mirror of
https://github.com/github/codeql.git
synced 2026-05-02 04:05:14 +02:00
Address review comments
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
|
||||
import rust
|
||||
import codeql.util.ReportStats
|
||||
import codeql.rust.elements.internal.CallExprImpl::Impl as CallExprImpl
|
||||
import codeql.rust.internal.TypeInference as TypeInference
|
||||
|
||||
/**
|
||||
@@ -20,7 +21,7 @@ private class RelevantFile extends File {
|
||||
|
||||
module CallTargetStats implements StatsSig {
|
||||
// TODO: Take other calls into account
|
||||
abstract private class CallExprBase extends ArgsExpr { }
|
||||
abstract private class CallExprBase extends InvocationExpr { }
|
||||
|
||||
private class CallExprCallExprBase extends CallExpr, CallExprBase { }
|
||||
|
||||
@@ -34,7 +35,7 @@ module CallTargetStats implements StatsSig {
|
||||
additional predicate isNotOkCall(CallExprBase c) {
|
||||
c.getFile() instanceof RelevantFile and
|
||||
not exists(c.getResolvedTarget()) and
|
||||
not c instanceof ClosureCallExpr
|
||||
not c instanceof CallExprImpl::DynamicCallExpr
|
||||
}
|
||||
|
||||
int getNumberOfNotOk() { result = count(CallExprBase c | isNotOkCall(c)) }
|
||||
|
||||
@@ -67,8 +67,9 @@ module ModelGeneratorCommonInput implements
|
||||
|
||||
string parameterExactAccess(R::ParamBase p) {
|
||||
result =
|
||||
"Argument[" + any(DataFlowImpl::ParameterPosition pos | p = pos.getParameterIn(_)).toString() +
|
||||
"]"
|
||||
"Argument[" +
|
||||
any(DataFlowImpl::RustDataFlow::ParameterPosition pos | p = pos.getParameterIn(_))
|
||||
.toString() + "]"
|
||||
}
|
||||
|
||||
string parameterApproximateAccess(R::ParamBase p) { result = parameterExactAccess(p) }
|
||||
@@ -78,12 +79,16 @@ module ModelGeneratorCommonInput implements
|
||||
}
|
||||
|
||||
bindingset[c]
|
||||
string paramReturnNodeAsApproximateOutput(QualifiedCallable c, DataFlowImpl::ParameterPosition pos) {
|
||||
string paramReturnNodeAsApproximateOutput(
|
||||
QualifiedCallable c, DataFlowImpl::RustDataFlow::ParameterPosition pos
|
||||
) {
|
||||
result = paramReturnNodeAsExactOutput(c, pos)
|
||||
}
|
||||
|
||||
bindingset[c]
|
||||
string paramReturnNodeAsExactOutput(QualifiedCallable c, DataFlowImpl::ParameterPosition pos) {
|
||||
string paramReturnNodeAsExactOutput(
|
||||
QualifiedCallable c, DataFlowImpl::RustDataFlow::ParameterPosition pos
|
||||
) {
|
||||
result = parameterExactAccess(c.getFunction().getParam(pos.getPosition()))
|
||||
or
|
||||
pos.isSelf() and result = qualifierString()
|
||||
@@ -134,7 +139,7 @@ private module SummaryModelGeneratorInput implements SummaryModelGeneratorInputS
|
||||
predicate isCallback(DataFlow::ContentSet cs) {
|
||||
exists(Content c | c = cs.(SingletonContentSet).getContent() |
|
||||
c instanceof FunctionCallReturnContent or
|
||||
c instanceof ClosureCallArgumentContent
|
||||
c instanceof FunctionCallArgumentContent
|
||||
)
|
||||
}
|
||||
|
||||
@@ -145,7 +150,7 @@ private module SummaryModelGeneratorInput implements SummaryModelGeneratorInputS
|
||||
or
|
||||
exists(Content c | cs = DataFlowImpl::TSingletonContentSet(c) |
|
||||
exists(int pos |
|
||||
pos = c.(ClosureCallArgumentContent).getPosition() and
|
||||
pos = c.(FunctionCallArgumentContent).getPosition() and
|
||||
result = "Parameter" and
|
||||
arg = pos.toString()
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user