Skip to content

Commit a72c25e

Browse files
trailer: add information about CVE-2025-47737
1 parent 8124c2e commit a72c25e

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
```toml
2+
[advisory]
3+
id = "RUSTSEC-0000-0000"
4+
package = "trailer"
5+
date = "2025-05-04"
6+
url = "https://github.com/Geal/trailer/issues/2"
7+
aliases = ["CVE-2025-47737"]
8+
cvss = "CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:L"
9+
```
10+
11+
# Unsound issue in Trailer
12+
13+
Our static analyzer find a potential unsound issue
14+
in the construction of Trailer, where it doesn't
15+
provide enough check to ensure the soundness.
16+
17+
trailer/src/lib.rs, Lines 18 to 25 in d474984:
18+
```
19+
pub fn new(capacity: usize) -> Trailer<T> {
20+
unsafe {
21+
let trailer = Trailer::allocate(capacity);
22+
let ptr = trailer.ptr as *mut T;
23+
ptr.write(T::default());
24+
trailer
25+
}
26+
}
27+
```
28+
29+
The constructor does check the T is not a ZST in
30+
rust, and allocating with size 0 is considered
31+
as undefined behaviors in Rust. A poc code like
32+
below can work:
33+
34+
```
35+
use trailer::Trailer;
36+
#[derive(Default)]
37+
struct Zst;
38+
39+
fn main() {
40+
let mut a = Trailer::<Zst>::new(0);
41+
drop(a);
42+
}
43+
```

0 commit comments

Comments
 (0)