mirror of
https://github.com/github/codeql.git
synced 2026-01-29 22:32:58 +01:00
Merge pull request #32 from max-schaefer/update-data-flow
Port recent data-flow improvements
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,6 @@
|
||||
private import go
|
||||
private import DataFlowUtil
|
||||
private import DataFlowImplCommon::Public
|
||||
private import DataFlowImplCommon
|
||||
|
||||
private newtype TReturnKind =
|
||||
TSingleReturn() or
|
||||
@@ -270,3 +270,5 @@ predicate isUnreachableInCall(Node n, DataFlowCall call) {
|
||||
guard.dominates(n.getBasicBlock())
|
||||
)
|
||||
}
|
||||
|
||||
int accessPathLimit() { result = 5 }
|
||||
|
||||
@@ -283,11 +283,10 @@ class CallNode extends ExprNode {
|
||||
exists(DataFlow::Node calleeSource | calleeSource = getACalleeSource() |
|
||||
result = calleeSource.asExpr()
|
||||
or
|
||||
exists(Method m, InterfaceType declaredRecv, Type actualRecv |
|
||||
calleeSource = m.getARead() and
|
||||
declaredRecv = m.getReceiverType().(NamedType).getBaseType() and
|
||||
actualRecv.implements(declaredRecv) and
|
||||
result = actualRecv.getMethod(m.getName()).(DeclaredFunction).getFuncDecl()
|
||||
exists(Method declared, Method actual |
|
||||
calleeSource = declared.getARead() and
|
||||
actual.implements(declared) and
|
||||
result = actual.(DeclaredFunction).getFuncDecl()
|
||||
)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -33,3 +33,7 @@ func test(x *s1, y s2, z s3, b mybool, i I) {
|
||||
id := func(x int) int { return x } // name: id
|
||||
id(1) // callee: id
|
||||
}
|
||||
|
||||
func test2(v interface{}) {
|
||||
v.(interface{ m(int) }).m(0) // callee: s3.m
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user