-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Wrong ptr dereferencing in Alloc::alloc_one #42827
Comments
For context: rust/src/liballoc/allocator.rs Lines 871 to 880 in 74fa279
|
Could you clarify what specifically is the problem with that implementation? |
I guess it's just typo. |
|
Underlying alloc: rust/src/liballoc/allocator.rs Line 481 in 74fa279
returns raw pointer *mut u8. alloc_one should just cast it to *mut T and wrap in Unique. Please see correct implementation in alloc_array: rust/src/liballoc/allocator.rs Line 947 in 74fa279
the diff and bug is in Unique::new(*p as *mut T) vs Unique::new(p as *mut T)
|
Oh no, casts |
This had an accidental `u8 as *mut T` where it was intended to have just a normal pointer-to-pointer cast. Closes rust-lang#42827
std: Fix implementation of `Alloc::alloc_one` This had an accidental `u8 as *mut T` where it was intended to have just a normal pointer-to-pointer cast. Closes rust-lang#42827
std: Fix implementation of `Alloc::alloc_one` This had an accidental `u8 as *mut T` where it was intended to have just a normal pointer-to-pointer cast. Closes rust-lang#42827
std: Fix implementation of `Alloc::alloc_one` This had an accidental `u8 as *mut T` where it was intended to have just a normal pointer-to-pointer cast. Closes rust-lang#42827
@pnkfelix
The text was updated successfully, but these errors were encountered: