-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Using grow
to shrink can cause corruption.
#149
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
# for free
to join this conversation on GitHub.
Already have an account?
# 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: