Closed
Description
Hi.
When running the following program:
use std::net::TcpStream;
fn main() {
let stream = TcpStream::connect("fsf.org:80");
}
If I compile with the flag -Z sanitizer=memory
and I run the program, the sanitizer will output the following error:
Uninitialized bytes in __interceptor_getaddrinfo at offset 7 inside [0x701000000010, 8)
==9249==WARNING: MemorySanitizer: use-of-uninitialized-value
#0 0x55c6d6a07757 in std::sys_common::net::lookup_host::h54f2b589f7709f14 /checkout/src/libstd/sys_common/net.rs:169
#1 0x55c6d6a0adc8 in std::net::lookup_host::h495894627525e525 /checkout/src/libstd/net/mod.rs:192
#2 0x55c6d6a0adc8 in std::net::addr::resolve_socket_addr::h63a9ed7b59f143af /checkout/src/libstd/net/addr.rs:861
#3 0x55c6d6a0adc8 in _$LT$str$u20$as$u20$std..net..addr..ToSocketAddrs$GT$::to_socket_addrs::h77d61f3135d300ed /checkout/src/libstd/net/addr.rs:911
#4 0x55c6d6996324 in _$LT$$RF$$u27$a$u20$T$u20$as$u20$std..net..addr..ToSocketAddrs$GT$::to_socket_addrs::hdbcabfd0f795b49b /checkout/src/libstd/net/addr.rs:928
#5 0x55c6d69953b8 in std::net::each_addr::hbc122545c1ddb016 /checkout/src/libstd/net/mod.rs:120
#6 0x55c6d69924f1 in std::net::tcp::TcpStream::connect::h4d0d665e79f451be /checkout/src/libstd/net/tcp.rs:154
#7 0x55c6d6997273 in test::main::hac3cfabc932bcf2d /test/src/main.rs:4
#8 0x55c6d69964f7 in std::rt::lang_start::_$u7b$$u7b$closure$u7d$$u7d$::hd3da46bdfa33d07c /checkout/src/libstd/rt.rs:74
#9 0x55c6d6a08c47 in std::rt::lang_start_internal::_$u7b$$u7b$closure$u7d$$u7d$::ha4e6f269ebba9c4a /checkout/src/libstd/rt.rs:59
#10 0x55c6d6a08c47 in _ZN3std9panicking3try7do_call17hdec9e3cbcdfae56cE.llvm.7538121503468158203 /checkout/src/libstd/panicking.rs:305
#11 0x55c6d6a1847b in __rust_maybe_catch_panic /checkout/src/libpanic_abort/lib.rs:40
SUMMARY: MemorySanitizer: use-of-uninitialized-value /checkout/src/libstd/sys_common/net.rs:169 in std::sys_common::net::lookup_host::h54f2b589f7709f14
Exiting
Rust version: rustc 1.27.0-nightly (056f589fb 2018-04-07)
Thanks to fix this issue.