You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In src/sys/socket/mod.rs, Multiheader::preallocate allocates a vec or MaybeUninit::uninit() and then passes each address.as_mut_ptr() to pack_mhdr_to_receive. pack_mhdr_to_receive in turn performs (*address).as_mut_ptr(), which results in undefined behavior.
To support this desired behavior SockaddrLikePriv must change the signature of as_mut_ptr to fn(*mut Self) -> *mut libc::sockaddr and use ptr::addr_of_mut! to access fields in implementations. It does not appear that performing *mut S as *mut libc::sockaddr is possible because () implements SockaddrLike but returns null_mut() from its SockaddrLikePriv implementation.
The text was updated successfully, but these errors were encountered:
In
src/sys/socket/mod.rs
,Multiheader::preallocate
allocates a vec orMaybeUninit::uninit()
and then passes eachaddress.as_mut_ptr()
topack_mhdr_to_receive
.pack_mhdr_to_receive
in turn performs(*address).as_mut_ptr()
, which results in undefined behavior.To support this desired behavior
SockaddrLikePriv
must change the signature ofas_mut_ptr
tofn(*mut Self) -> *mut libc::sockaddr
and useptr::addr_of_mut!
to access fields in implementations. It does not appear that performing*mut S as *mut libc::sockaddr
is possible because()
implementsSockaddrLike
but returnsnull_mut()
from itsSockaddrLikePriv
implementation.The text was updated successfully, but these errors were encountered: