Merge pull request #850 from ammaraskar/through

Report double-free in through crate
This commit is contained in:
Sergey "Shnatsel" Davidoff
2021-03-30 04:23:56 +02:00
committed by GitHub

View File

@@ -0,0 +1,22 @@
```toml
[advisory]
id = "RUSTSEC-0000-0000"
package = "through"
date = "2021-02-18"
url = "https://github.com/gretchenfrage/through/issues/1"
categories = ["memory-corruption"]
keywords = ["memory-safety", "double-free"]
[versions]
patched = []
```
# `through` and `through_and` causes a double free if the map function panics
`through` and `through_and` take a mutable reference as well as a mapping
function to change the provided reference. They do this by calling `ptr::read`
on the reference which duplicates ownership and then calling the mapping
function.
If the mapping function panics, both the original object and the one
duplicated by `ptr::read` get dropped, causing a double free.