Skip to content

Commit 3cdd3c4

Browse files
shinmaoShnatsel
andauthored
Report unsoundness and patch in fyrox-core (#2172)
* Report unsoundness and patch in fyrox-core * list fixed version --------- Co-authored-by: Sergey "Shnatsel" Davidoff <shnatsel@gmail.com>
1 parent 368cc73 commit 3cdd3c4

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
```toml
2+
[advisory]
3+
id = "RUSTSEC-0000-0000"
4+
package = "fyrox-core"
5+
date = "2024-12-19"
6+
url = "https://github.com/FyroxEngine/Fyrox/issues/630"
7+
references = ["https://github.com/FyroxEngine/Fyrox/pull/662"]
8+
categories = []
9+
keywords = ["uninitialized"]
10+
informational = "unsound"
11+
12+
[versions]
13+
patched = [">= 0.36"]
14+
15+
[affected]
16+
functions = {"fyrox_core::transmute_vec_as_bytes" = [">= 0.28.1, <= 0.36"]}
17+
```
18+
19+
# Unsound usages of `Vec::from_raw_parts`
20+
21+
The library provides a public safe API `transmute_vec_as_bytes`, which incorrectly assumes that any generic type `T` could have stable layout, causing to uninitialized memory exposure if the users pass any types with padding bytes as `T` and cast it to `u8` pointer.
22+
23+
In the [issue](https://github.com/FyroxEngine/Fyrox/issues/630), we develop a PoC to show passing struct type to `transmute_vec_as_bytes` could lead to undefined behavior with `Vec::from_raw_parts`.
24+
25+
The developers provide a patch by changing trait of `Copy` to `Pod`, which can make sure `T` should be plain data. This was patched in the latest version of [master](https://github.com/FyroxEngine/Fyrox/blob/3f9ad6f9667047dac051b0e97d544e5b38e5ae72/fyrox-core/src/lib.rs#L351-L360) branch, but still not on the latest release (0.28.1).

0 commit comments

Comments
 (0)