Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upfrom_elem is unsound when clone can panic #101
Closed
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
added 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 -->
|
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
clonepanics duringSmallVec::from_elemthen 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
SetLenOnDropto make sure the length is set correctly when destructors run, without inhibiting optimizations.