Expand description
§A Very unsafe lifetime extender with only safe Rust
This crate is published for a severe bug that allow user write safe code to extend the lifetime of any object, which is unacceptable since such behavior may easily leads to UAF, double free and many UB. This crate should NOT used in the real life, since it relies on a BUG, not a feature.
Here, 2 functions are provided, one is extend
, which could extend any borrow’s lifetime to
'static
(should be the longest lifetime), and another is the mutable version extend_mut
,
which could extend the mutable borrows. The former one may easily leads to UAF, and the second
one
The crate uses !#[forbid(unsafe_code)]
to ensure only safe rust is used.
All the functions are ZCA, which could be directly optimized out.
By default, all functions are hidden since you should use none of them. You could test them
with the related feature (in case some of them is fixed and others have not.)
Using the most dangerous i-can-do-whatever-the-fxxk-i-want
feature gate would enable all
the features.
Functions§
- extend
test-borrow
- extend the current lifetime to
'static
. - extend_
mut test-borrow-mut
- extend the current mutable borrow’s lifetime to
'static
- make_
static test-fake-static-borrow
- a similar function from fake-static, doing the same things as
extend
- make_
static_ mut test-fake-static-borrow-mut
- a similar function from fake-static, doing the same things as
extend_mut