Skip to content

Commit

Permalink
Fix: synthetic nodes's tags were ignored.
Browse files Browse the repository at this point in the history
  • Loading branch information
victornicolet committed Nov 18, 2024
1 parent ef33798 commit 24d9448
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions analysis/dataflow/inter_procedural.go
Original file line number Diff line number Diff line change
Expand Up @@ -355,12 +355,7 @@ func scanEntryPoints(
// TODO: try to factor out the special cases in the isEntryPointGraphNode functions
switch node := n.(type) {
case *SyntheticNode:
if _, isStore := node.instr.(*ssa.Store); !isStore {
// all other non-store synthetic nodes are entry points.
// WARNING: revise when this changes!
entry := NodeWithTrace{Node: node}
entryPoints[entry.Key()] = entry
}
addSyntheticNodeEntryPoints(spec, entryPoints, node)
case *CallNodeArg:
if spec.MarkCallArgsLikeCall &&
spec.IsEntryPointSsa(node.parent.CallSite().Value()) {
Expand All @@ -383,6 +378,23 @@ func scanEntryPoints(
}
}

func addSyntheticNodeEntryPoints(
spec ScanningSpec,
entryPoints map[KeyType]NodeWithTrace,
node *SyntheticNode) {
if spec.IsEntryPointSsa == nil {
return
}
asValue, isValue := node.Instr().(ssa.Node)
if !isValue {
return
}
if spec.IsEntryPointSsa(asValue) {
entry := NodeWithTrace{Node: node}
entryPoints[entry.Key()] = entry
}
}

// addWithContexts adds an entry corresponding to node in each of the contexts to the entryPoints
// if contexts is empty or nil, then the node is added without context
func addWithContexts(contexts []*CallStack, node GraphNode, entryPoints map[KeyType]NodeWithTrace) {
Expand Down

0 comments on commit 24d9448

Please sign in to comment.