-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle functions stored and called from struct fields #23
Comments
Some other call graph algorithm visualizations for fun: data = {
const csvData = await FileAttachment("[email protected]").csv();
// assuming your data has source and target columns
const links = csvData.map(d => ({source: d.source_func, target: d.target_func}));
// get unique nodes
const nodes = Array.from(new Set(links.flatMap(l => [l.source, l.target])), id => ({id}));
return {nodes, links};
} ForceGraph(data, {
nodeId: (d) => d.id, // node identifier, to match links
nodeTitle: (d) => d.id, // hover text
width: 4000,
height: 4000,
invalidation // stop when the cell is re-run
})
|
Continuing to revisit this problem, attempting to rephrase it: I'm trying to find instances of function calls that are reachable from This also begs the question, for the case of SQL injection analysis, if there might be merit in dropping the "reachable from n6:(*database/sql.DB).Query → n4:login → n5:startServer$1 → n9:(*net/http.ServeMux).HandleFunc Today, we identify paths from the "root" ( Line 70 in ca0546c
🤔 If we started at But, it might be nice to have both "forward" and "backward" call graph path analysis that are robust to use the "right tool for the job" when possible. |
Today, functions that are stored and called from struct fields aren't handled properly when constructing the call graph. Let's look at the following example program where a function called (
run
) is used in thecommand
struct:The resulting call graph ends up being:
☝️ Notice how
(*database/sql.DB).Query
is there, but there's no call path that can be constructed back tomain
. To illustrate this, we can start at the SQL query, and work our way back:n2:main$1
, while it looks like it'sn0:main
, and that's even almost the case, it's really the anonymous function defined inmain
(func(args []string) error {...}
). It's also just a coincidence of the example, and that "chain" could be broken otherwise; like, ifc := &cli{ ... }
happened in a global variable instead.So, we need a way to link
n2:main$1
back ton0:main
to solve this issue.The text was updated successfully, but these errors were encountered: