File tree Expand file tree Collapse file tree 1 file changed +49
-0
lines changed
Expand file tree Collapse file tree 1 file changed +49
-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+ [versions ]
11+ patched = []
12+ unaffected = []
13+
14+ [affected ]
15+ ```
16+
17+ # Unsound issue in Trailer
18+
19+ Our static analyzer find a potential unsound issue
20+ in the construction of Trailer, where it doesn't
21+ provide enough check to ensure the soundness.
22+
23+ trailer/src/lib.rs, Lines 18 to 25 in d474984:
24+ ```
25+ pub fn new(capacity: usize) -> Trailer<T> {
26+ unsafe {
27+ let trailer = Trailer::allocate(capacity);
28+ let ptr = trailer.ptr as *mut T;
29+ ptr.write(T::default());
30+ trailer
31+ }
32+ }
33+ ```
34+
35+ The constructor does check the T is not a ZST in
36+ rust, and allocating with size 0 is considered
37+ as undefined behaviors in Rust. A poc code like
38+ below can work:
39+
40+ ```
41+ use trailer::Trailer;
42+ #[derive(Default)]
43+ struct Zst;
44+
45+ fn main() {
46+ let mut a = Trailer::<Zst>::new(0);
47+ drop(a);
48+ }
49+ ```
You can’t perform that action at this time.
0 commit comments