This repository was archived by the owner on Jul 3, 2024. It is now read-only.
[Issue #70] Warn about the use of release on std::unique_ptr#79
Open
lklein53 wants to merge 2 commits intomgehre:lifetimefrom
Open
[Issue #70] Warn about the use of release on std::unique_ptr#79lklein53 wants to merge 2 commits intomgehre:lifetimefrom
lklein53 wants to merge 2 commits intomgehre:lifetimefrom
Conversation
New warning needs to be added as expected once it is implemented
mgehre
reviewed
Nov 11, 2019
| explicit unique_ptr(T *t); | ||
| T *release(); | ||
| }; | ||
| // A random class that models a private key. |
Owner
There was a problem hiding this comment.
Can we remove unrelated information? Same for all mentions of PrivateKey
Xazax-hun
reviewed
Nov 22, 2019
| if (!Callee) | ||
| return; | ||
|
|
||
| if (auto MCE = dyn_cast<CXXMemberCallExpr>(CallE)) { |
Collaborator
There was a problem hiding this comment.
This is good for getting rid of the false positive but in the future I think it would be great to:
- Update the state, so we know what is the pointee of the returned ptr (*uniqueptr in our case).
- Set the unique_ptr to null. I am not sure if we support nullable owners properly at the point. The current paper also does not really elaborate on this.
- Maybe we need a way to annotate ownership transferring functions in the future? Not all of them migh have the name release.
Some of these notes are more for our future selves designing a new version of the analysis, rather than the current implementation :)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently only the detection is implemented. Wasn't sure about the warning policy. The new warning doesn't really seem to fit for the LifetimeReporter