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
Don't include arg -> param edges in PathGraph::edges where arg is not reachable #7526
base: main
Are you sure you want to change the base?
Don't include arg -> param edges in PathGraph::edges where arg is not reachable #7526
Conversation
…ot reachable This avoids lots of missing-node warnings from `codeql bqrs interpret` as it discards the nodes that occur in the `edges` relation but not `nodes`. The problem arises because subpaths introduced two variants of `reach`, one of which is more restrictive than simply `reach(succ) and succ = pred.getASuccessor()`, so it no longer suffices to just check that the successor is reachable.
| @@ -3416,7 +3416,7 @@ private predicate pathSuccPlus(PathNode n1, PathNode n2) = fastTC(pathSucc/2)(n1 | ||
| */ | ||
| module PathGraph { | ||
| /** Holds if `(a,b)` is an edge in the graph of data flow path explanations. */ | ||
| query predicate edges(PathNode a, PathNode b) { a.getASuccessor() = b and reach(b) } | ||
| query predicate edges(PathNode a, PathNode b) { a.getASuccessor() = b and reach(a) and reach(b) } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we shouldn't restrict sub path nodes to those that can reach a sink as well. I.e., redefine retReach as
predicate retReach(PathNode n) {
exists(PathNodeMid out |
subpaths(_, _, n, out) and
reach(out)
)
or
exists(PathNode mid |
retReach(mid) and
n.getASuccessor() = mid and
not subpaths(_, mid, _, _)
)
}@aschackmull : What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That makes sense, although I think I'd prefer
predicate retReach(PathNode n) {
exists(PathNodeMid out |
subpaths(_, _, n, out)
|
directReach(out) or retReach(out)
)
or
exists(PathNode mid |
retReach(mid) and
n.getASuccessor() = mid and
not subpaths(_, mid, _, _)
)
}to avoid making it mutually recursive with reach.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might also want to restrict the final subpaths relation if we want to get rid of the Skipping subpaths tuple with missing node warnings.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, we should certainly also restrict subpaths.
|
The changes to the |


This avoids lots of missing-node warnings from
codeql bqrs interpretas it discards the nodes that occur in theedgesrelation but notnodes. The problem arises because subpaths introduced two variants ofreach, one of which is more restrictive than simplyreach(succ) and succ = pred.getASuccessor(), so it no longer suffices to just check that the successor is reachable.Suggestions re: the best way to test this welcome.
The text was updated successfully, but these errors were encountered: