-
Notifications
You must be signed in to change notification settings - Fork 150
Using grow
to shrink can cause corruption.
#149
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
Labels
Comments
Would you like to make a pull request and add a unit test? |
bors-servo
pushed a commit
that referenced
this issue
Jun 7, 2019
Fix using `grow` to shrink to inline. Using `grow` on a spilled SmallVec to shrink to an unspilled SmallVec would result in a corrupted structure, as `capacity` was not updated. Fixes #149 <!-- 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/152) <!-- Reviewable:end -->
Shnatsel
referenced
this issue
Jun 29, 2019
This is what the standard Vec does; see rust-lang/rust#32012.
This was referenced Jun 29, 2019
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If
grow
is given a size that is within the inline size after a SmallVec has been spilled, the resulting value is corrupted.This is admittedly unusual, most code would use
shrink_to_fit
.I think the following should fix it.
The text was updated successfully, but these errors were encountered: