- Reported
-
- Issued
-
- Package
-
inventory
(crates.io)
- Type
-
INFO
Unsound
- Keywords
-
#life-before-main
- Aliases
-
- References
-
- Patched
-
Description
Affected versions allow arbitrary caller-provided code to execute before the
lifetime of main
.
If the caller-provided code accesses particular pieces of the standard library
that require an initialized Rust runtime, such as std::io
or std::thread
,
these may not behave as documented. Panics are likely; UB is possible.
The flaw was corrected by enforcing that only code written within the
inventory
crate, which is guaranteed not to access runtime-dependent parts of
the standard library, runs before main
. Caller-provided code is restricted to
running at compile time.
Advisory available under CC0-1.0
license.