Skip to content

Commit 2b53054

Browse files
authored
Merge pull request #847 from ammaraskar/stackvector
Report out-of-bounds write in stackvec
2 parents 2010e5c + d93ffb2 commit 2b53054

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
```toml
2+
[advisory]
3+
id = "RUSTSEC-0000-0000"
4+
package = "stackvector"
5+
date = "2021-02-19"
6+
url = "https://github.com/Alexhuszagh/rust-stackvector/issues/2"
7+
categories = ["memory-corruption"]
8+
9+
[versions]
10+
patched = []
11+
```
12+
13+
# StackVec::extend can write out of bounds when size_hint is incorrect
14+
15+
`StackVec::extend` used the lower and upper bounds from an Iterator's
16+
`size_hint` to determine how many items to push into the stack based vector.
17+
18+
If the `size_hint` implementation returned a lower bound that was larger than
19+
the upper bound, `StackVec` would write out of bounds and overwrite memory
20+
on the stack. As mentioned by the [size_hint](https://doc.rust-lang.org/std/iter/trait.Iterator.html#provided-methods)
21+
documentation, `size_hint` is mainly for optimization and incorrect
22+
implementations should not lead to memory safety issues.

0 commit comments

Comments
 (0)