Closed picatz closed 10 months ago
func (*types.object).Pkg() *types.Package
Pkg
returns the package to which the object belongs. The result isnil
for labels and objects in the Universe scope.The Universe scope contains all predeclared objects of Go. It is the outermost scope of any chain of nested scopes. https://go.dev/src/go/types/universe.go
Tracked down the source of the issue:
} else if err != nil {
panic("error while scanning from memory: " + err.Error())
}
Specifically, this interface method call:
err.Error()
https://github.com/picatz/taint/blob/5d93683df8f992ef11dc052f2d2c53337a69c8b3/callgraph/callgraph.go#L135
☝️ This is an overly optimistic selector expression for the instruction call method's package path. This should be avoided, even if it makes it a bit more verbose, by performing proper
nil
checks. This means we'll likely need to handle resolving the*ssa.Function
for this case; I'm assuming this is a builtin function.