-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Rust: Query for access to a dangling pointer #18300
base: main
Are you sure you want to change the base?
Conversation
maybeOnStack(a, ce.getEnclosingBlock()) and | ||
ce.getStaticTarget() = b.getEnclosingCallable() | ||
) | ||
} |
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.
An entirely different approach is possible, where having done the data flow we would check the control flow as well, all the way from the pointer creation to dereference, to see if it crosses a point where the objects lifetime ends. I ran into problems even defining these points, wasn't sure how best to implement that kind of flow effectively, and my attempts didn't get good results so I changed tactics. Nevertheless it could be more accurate in the sense of finding more results, and some of these issues might get easier as our libraries mature.
Query for access to a dangling pointer, i.e. something along the lines of:
This is a draft because I still need to:
Then I will need:
As you can see from the test, there are a lot of cases we don't cover yet, which will be follow-up work. Right now I want to get a minimal version of the query merged before worrying about them too much.