diff options
| author | CAD97 <cad97@cad97.com> | 2020-06-30 12:42:09 -0400 |
|---|---|---|
| committer | CAD97 <cad97@cad97.com> | 2020-06-30 15:02:21 -0400 |
| commit | 0aecf3c74b7fd09460f453e7e95ae8cb65a92440 (patch) | |
| tree | c146f4d906331b0eb5242866c1586376fe0ad647 /src/liballoc | |
| parent | fc3dc723da8daef495a170e02efb38093e05215e (diff) | |
| download | rust-0aecf3c74b7fd09460f453e7e95ae8cb65a92440.tar.gz rust-0aecf3c74b7fd09460f453e7e95ae8cb65a92440.zip | |
Fix invalid pointer deref in Weak::as_ptr
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/rc.rs | 2 | ||||
| -rw-r--r-- | src/liballoc/sync.rs | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/liballoc/rc.rs b/src/liballoc/rc.rs index 8f7b8efd811..ab64d533087 100644 --- a/src/liballoc/rc.rs +++ b/src/liballoc/rc.rs @@ -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)) } } diff --git a/src/liballoc/sync.rs b/src/liballoc/sync.rs index 27c36f4a569..e9af80d326f 100644 --- a/src/liballoc/sync.rs +++ b/src/liballoc/sync.rs @@ -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)) } } |
