-
Notifications
You must be signed in to change notification settings - Fork 145
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
from_elem is unsound when clone can panic #101
Labels
Comments
mbrubeck
added a commit
to mbrubeck/rust-smallvec
that referenced
this issue
Jul 18, 2018
Merged
mbrubeck
added a commit
to mbrubeck/rust-smallvec
that referenced
this issue
Jul 18, 2018
bors-servo
pushed a commit
that referenced
this issue
Jul 19, 2018
Panic-safety fixes * Make from_elem panic-safe. Fixes #101. * Make insert_many panic-safe. Fixes #96. r? @SimonSapin or @jdm. cc @Vurich <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/rust-smallvec/103) <!-- Reviewable:end -->
9 tasks
Dropping unintialized memory could be considered a vulnerability, which is equivalent to |
This bug never made it into a release. No dependencies were ever affected, so no need for an advisory. We still have #156 outstanding though |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If
clone
panics duringSmallVec::from_elem
then uninitialized memory is dropped. [Original report by dbaupp on Reddit.]This bug was introduced by #93 which is not yet included in the latest published release (0.6.2).
The suggested solution is to use something like
SetLenOnDrop
to make sure the length is set correctly when destructors run, without inhibiting optimizations.The text was updated successfully, but these errors were encountered: