-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TCell
is unsound due to covariant Q
parameter of TCellOwner
(and the same applies to TLCell
)
#20
Comments
TCell
unsound due to covariant Q
parameter (and the same applies to TLCell
)TCell
is unsound due to covariant Q
parameter of TCellOwner
(and the same applies to TLCell
)
Similar problem with covariance of use qcell::{TCell, TCellOwner};
type T1 = fn(&());
type T2 = fn(&'static ());
// T1 subtype of T2, both 'static
fn main() {
let first_owner = TCellOwner::<T1>::new();
let mut second_owner = TCellOwner::<T2>::new();
let mut x = TCell::<T1, _>::new(vec!["Hello World!".to_owned()]);
let reference = &first_owner.ro(&x)[0];
second_owner.rw(&x as &TCell::<T2, Vec<_>>).clear();
println!("{}", reference); // ��&d��i
// (or similar output)
} |
AFAICT, all published versions of |
Thanks for spotting this. So I guess this is because Rust will cast the type, but gives it a different type-ID. I will go through your PR later and make sure I fully understand the issue and the solution. Thanks again. |
Fixed in version 0.4.3. All previous versions have been yanked. I think it's unlikely anyone is stuck on pre-0.4 versions. Let me know if this causes someone a problem. Note for anyone trying to understand the issue: this bug does not affect non-malicious programmers. Existing non-malicious code remains sound. By fixing this bug and yanking all other affected versions all that we're doing is potentially stopping a malicious coder from creating undefined behaviour without using |
The text was updated successfully, but these errors were encountered: