Fix invalid pointer deref in Weak::as_ptr
This commit is contained in:
parent
fc3dc723da
commit
0aecf3c74b
2 changed files with 2 additions and 2 deletions
|
|
@ -1711,7 +1711,7 @@ impl<T> Weak<T> {
|
|||
// because dangling weaks are only created for sized T. wrapping_offset
|
||||
// is used so that we can use the same code path for dangling weak refs.
|
||||
unsafe {
|
||||
let offset = data_offset(&raw const (*ptr).value);
|
||||
let offset = data_offset(fake_ptr);
|
||||
set_data_ptr(fake_ptr, (ptr as *mut u8).wrapping_offset(offset))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1479,7 +1479,7 @@ impl<T> Weak<T> {
|
|||
// because dangling weaks are only created for sized T. wrapping_offset
|
||||
// is used so that we can use the same code path for dangling weak refs.
|
||||
unsafe {
|
||||
let offset = data_offset(&raw const (*ptr).data);
|
||||
let offset = data_offset(fake_ptr);
|
||||
set_data_ptr(fake_ptr, (ptr as *mut u8).wrapping_offset(offset))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue