Open connor4312 opened 4 months ago
Same here on latest Rust nightly (1.81.0-nightly (b5b13568f 2024-06-10)
) and latest ureq+native_tls. Doesn't happen on release builds at all.
unsafe precondition(s) violated: slice::from_raw_parts requires the pointer to be aligned and non-null, and the total size of the slice not to exceed `isize::MAX`
stack backtrace:
0: std::panicking::begin_panic_handler
at /rustc/b5b13568fb5da4ac988bde370008d6134d3dfe6c/library\std\src\panicking.rs:652
1: core::panicking::panic_nounwind_fmt::runtime
at /rustc/b5b13568fb5da4ac988bde370008d6134d3dfe6c/library\core\src\panicking.rs:110
2: core::panicking::panic_nounwind_fmt
at /rustc/b5b13568fb5da4ac988bde370008d6134d3dfe6c/library\core\src\panicking.rs:120
3: core::panicking::panic_nounwind
at /rustc/b5b13568fb5da4ac988bde370008d6134d3dfe6c/library\core\src\panicking.rs:219
4: core::slice::raw::from_raw_parts::precondition_check
at /rustc/b5b13568fb5da4ac988bde370008d6134d3dfe6c\library\core\src\ub_checks.rs:68
5: core::slice::raw::from_raw_parts
at /rustc/b5b13568fb5da4ac988bde370008d6134d3dfe6c\library\core\src\ub_checks.rs:75
6: schannel::context_buffer::impl$1::deref
at C:\Users\solik\.cargo\registry\src\index.crates.io-6f17d22bba15001f\schannel-0.1.20\src\context_buffer.rs:20
7: schannel::tls_stream::TlsStream,alloc::alloc::Global> >::step_initialize,alloc::alloc::Global> >
at C:\Users\solik\.cargo\registry\src\index.crates.io-6f17d22bba15001f\schannel-0.1.20\src\tls_stream.rs:579
8: schannel::tls_stream::TlsStream,alloc::alloc::Global> >::initialize,alloc::alloc::Global> >
at C:\Users\solik\.cargo\registry\src\index.crates.io-6f17d22bba15001f\schannel-0.1.20\src\tls_stream.rs:655
9: schannel::tls_stream::MidHandshakeTlsStream,alloc::alloc::Global> >::handshake,alloc::alloc::Global> >
at C:\Users\solik\.cargo\registry\src\index.crates.io-6f17d22bba15001f\schannel-0.1.20\src\tls_stream.rs:972
10: schannel::tls_stream::Builder::initialize,alloc::alloc::Global> >
at C:\Users\solik\.cargo\registry\src\index.crates.io-6f17d22bba15001f\schannel-0.1.20\src\tls_stream.rs:218
11: schannel::tls_stream::Builder::connect,alloc::alloc::Global> >
at C:\Users\solik\.cargo\registry\src\index.crates.io-6f17d22bba15001f\schannel-0.1.20\src\tls_stream.rs:145
12: native_tls::imp::TlsConnector::connect,alloc::alloc::Global> >
at C:\Users\solik\.cargo\registry\src\index.crates.io-6f17d22bba15001f\native-tls-0.2.12\src\imp\schannel.rs:320
13: native_tls::TlsConnector::connect,alloc::alloc::Global> >
at C:\Users\solik\.cargo\registry\src\index.crates.io-6f17d22bba15001f\native-tls-0.2.12\src\lib.rs:511
14: ureq::ntls::impl$0::connect
at C:\Users\solik\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ureq-2.9.7\src\ntls.rs:16
15: ureq::stream::connect_https
at C:\Users\solik\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ureq-2.9.7\src\stream.rs:340
16: ureq::unit::connect_socket
at C:\Users\solik\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ureq-2.9.7\src\unit.rs:371
17: ureq::unit::connect_inner
at C:\Users\solik\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ureq-2.9.7\src\unit.rs:256
18: ureq::unit::connect
at C:\Users\solik\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ureq-2.9.7\src\unit.rs:162
19: ureq::request::impl$1::do_call::closure$0
at C:\Users\solik\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ureq-2.9.7\src\request.rs:150
20: ureq::request::Request::do_call
at C:\Users\solik\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ureq-2.9.7\src\request.rs:166
21: ureq::request::Request::send_form
at C:\Users\solik\.cargo\registry\src\index.crates.io-6f17d22bba15001f\ureq-2.9.7\src\request.rs:272
Doesn't happen on release builds at all
Precondition assertions are only enabled by default on debug builds
Anyone having a case and more details to consistently reproduce?
Does it happen always or only sometimes?
On rustc 1.81.0-nightly (3cf924b93 2024-06-15)
I tried multiple versions (ureq, reqwest) on Win 10+11 and could not reproduce.
Anyone having a case and more details to consistently reproduce? Does it happen always or only sometimes? On
rustc 1.81.0-nightly (3cf924b93 2024-06-15)
I tried multiple versions (ureq, reqwest) on Win 10+11 and could not reproduce.
I delete cargo.lock and generate a new one, it fixed. Now I can debug my rust program. And I find the version of schannel is different (same cargo.toml)
[dependencies]
tokio = { version = "1", features = ["full"] }
futures = { version = "^0.3.23" }
clap = "2.34.0"
reqwest = { version = "0.12", features = ["json"] }
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0.79"
anyhow = "1.0"
thiserror = { version = "1.0.22" }
prost = "0.10.0"
It will compile schannel v0.1.20 before and produce the panic, now it will compile schannel v0.1.23 and will not produce the panic, I hope this information could help.
Unfortunately we're using 0.1.23 and still see the panic (this is my lockfile)
Had the same problem with 0.1.19 on windows 10 and rust 1.79.0, upgrading to 0.1.23 solved it for me - fix commit
Any occurences in recent rust versions and 0.1.24?
I encountered this panic making a request using reqwest with the Tokio runtime. This seems to be an UB caughted by the new precondition assertions.
Here's the backtrace: