File tree Expand file tree Collapse file tree 1 file changed +43
-0
lines changed
Expand file tree Collapse file tree 1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change 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+ ```
You can’t perform that action at this time.
0 commit comments