Skip to content

Fix potential buffer overflow in insert_many#254

Merged
bors-servo merged 1 commit into
servo:masterfrom
mbrubeck:overflow
Jan 8, 2021
Merged

Fix potential buffer overflow in insert_many#254
bors-servo merged 1 commit into
servo:masterfrom
mbrubeck:overflow

Conversation

@mbrubeck

@mbrubeck mbrubeck commented Jan 8, 2021

Copy link
Copy Markdown
Collaborator

Fixes #252.

@mbrubeck

mbrubeck commented Jan 8, 2021

Copy link
Copy Markdown
Collaborator Author

Pushed a different version of the fix. This is a more invasive change, but it leaves the code a bit simpler and much easier to reason about.

The key observation is that the guard is no longer needed after we fill up the initial lower_size_bound slots of reserved space. While looping through any surplus items from the iterator, the SmallVec is in a valid state at the start and end of each iteration.

@emilio emilio left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me with that change unless I'm missing something.

Comment thread src/lib.rs Outdated
@mbrubeck

mbrubeck commented Jan 8, 2021

Copy link
Copy Markdown
Collaborator Author

@bors-servo r=emilio

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit 9998ba0 has been approved by emilio

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit 9998ba0 with merge 4e53e07...

@bors-servo

Copy link
Copy Markdown
Contributor

☀️ Test successful - checks-travis
Approved by: emilio
Pushing 4e53e07 to master...

@bors-servo bors-servo merged commit 4e53e07 into servo:master Jan 8, 2021
mbrubeck added a commit that referenced this pull request Jan 8, 2021
Backport of #254 to the 0.6 branch.  Fixes #253.
EffortlessSteven added a commit to EffortlessMetrics/unsafe-review that referenced this pull request May 18, 2026
Record servo/rust-smallvec#254 as an additional real PR-diff dogfood sample and keep support-tier claims experimental.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Buffer overflow in insert_many()

3 participants