Skip to content

Commit 38d6997

Browse files
radekvitdjc
authored andcommitted
Add advisory for use after free in pared <=0.3.0
1 parent 825bd26 commit 38d6997

File tree

1 file changed

+41
-0
lines changed

1 file changed

+41
-0
lines changed

crates/pared/RUSTSEC-0000-0000.md

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
```toml
2+
[advisory]
3+
id = "RUSTSEC-0000-0000"
4+
package = "pared"
5+
date = "2025-03-13"
6+
url = "https://github.com/radekvit/pared/issues/2"
7+
categories = ["code-execution", "memory-corruption"]
8+
9+
[versions]
10+
patched = [">= 0.4.0"]
11+
12+
[affected]
13+
14+
[affected.functions]
15+
"pared::prc::Prc::from_rc" = ["< 0.4.0"]
16+
"pared::prc::Prc::project" = ["< 0.4.0"]
17+
"pared::prc::Prc::try_from_rc" = ["< 0.4.0"]
18+
"pared::sync::Parc::from_arc" = ["< 0.4.0"]
19+
"pared::sync::Parc::project" = ["< 0.4.0"]
20+
"pared::sync::Parc::try_from_arc" = ["< 0.4.0"]
21+
```
22+
23+
# Use after free in `Parc` and `Prc` due to missing lifetime constraints
24+
Affected versions of this crate didn't provide sufficient lifetime constraints to conversion
25+
functions from `alloc::sync::Arc` and `alloc::rc::Rc`, which made it possible to create
26+
projections of these reference counted pointers. Unlike the original reference counted pointers,
27+
these projections could outlive original data's lifetimes.
28+
29+
This projected pointer could cause the original `Arc`'s or `Rc`'s `Drop::drop` to get called at
30+
a point where the original data was no longer valid, leading to a potential use after free.
31+
32+
The affected functions were
33+
- `pared::prc::Prc::from_rc`
34+
- `pared::prc::Prc::project`
35+
- `pared::prc::Prc::try_from_rc`
36+
- `pared::sync::Parc::from_arc`
37+
- `pared::sync::Parc::project`
38+
- `pared::sync::Parc::try_from_arc`
39+
40+
This flaw was fixed in [108f540ea8acb6073751a1aa386085c1cdc4fd1e](https://github.com/radekvit/pared/commit/108f540ea8acb6073751a1aa386085c1cdc4fd1e)
41+
by requiring that the type stored in the `Arc`s and `Rc`s passed to these functions contain `T: 'static`.

0 commit comments

Comments
 (0)