steffengy / schannel-rs

Schannel API-bindings for rust (provides an interface for native SSL/TLS using windows APIs)
MIT License
46 stars 50 forks source link

Panics on Rust 1.78: "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`" #106

Open connor4312 opened 4 months ago

connor4312 commented 4 months ago

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:

thread 'main' panicked at library\core\src\panicking.rs:156:5:
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/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\std\src\panicking.rs:645
   1: core::panicking::panic_nounwind_fmt::runtime
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\core\src\panicking.rs:110
   2: core::panicking::panic_nounwind_fmt
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\core\src\panicking.rs:123
   3: core::panicking::panic_nounwind
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library\core\src\panicking.rs:156
   4: core::slice::raw::from_raw_parts::precondition_check
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6\library\core\src\intrinsics.rs:2799
   5: core::slice::raw::from_raw_parts<u8>
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6\library\core\src\slice\raw.rs:98
   6: schannel::context_buffer::impl$1::deref
             at C:\Users\conno\.cargo\registry\src\index.crates.io-6f17d22bba15001f\schannel-0.1.20\src\context_buffer.rs:20
   7: schannel::tls_stream::TlsStream<tokio_native_tls::AllowStd<tokio::net::tcp::stream::TcpStream> >::step_initialize<tokio_native_tls::AllowStd<tokio::net::tcp::stream::TcpStream> >
             at C:\Users\conno\.cargo\registry\src\index.crates.io-6f17d22bba15001f\schannel-0.1.20\src\tls_stream.rs:579
   8: schannel::tls_stream::TlsStream<tokio_native_tls::AllowStd<tokio::net::tcp::stream::TcpStream> >::initialize<tokio_native_tls::AllowStd<tokio::net::tcp::stream::TcpStream> >
             at C:\Users\conno\.cargo\registry\src\index.crates.io-6f17d22bba15001f\schannel-0.1.20\src\tls_stream.rs:655
   9: schannel::tls_stream::MidHandshakeTlsStream<tokio_native_tls::AllowStd<tokio::net::tcp::stream::TcpStream> >::handshake<tokio_native_tls::AllowStd<tokio::net::tcp::stream::TcpStream> >
             at C:\Users\conno\.cargo\registry\src\index.crates.io-6f17d22bba15001f\schannel-0.1.20\src\tls_stream.rs:972
  10: native_tls::imp::MidHandshakeTlsStream<tokio_native_tls::AllowStd<tokio::net::tcp::stream::TcpStream> >::handshake<tokio_native_tls::AllowStd<tokio::net::tcp::stream::TcpStream> >
             at C:\Users\conno\.cargo\registry\src\index.crates.io-6f17d22bba15001f\native-tls-0.2.11\src\imp\schannel.rs:206
  11: native_tls::MidHandshakeTlsStream<tokio_native_tls::AllowStd<tokio::net::tcp::stream::TcpStream> >::handshake<tokio_native_tls::AllowStd<tokio::net::tcp::stream::TcpStream> >
             at C:\Users\conno\.cargo\registry\src\index.crates.io-6f17d22bba15001f\native-tls-0.2.11\src\lib.rs:255
  12: tokio_native_tls::impl$18::poll<tokio::net::tcp::stream::TcpStream>
             at C:\Users\conno\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-native-tls-0.3.1\src\lib.rs:366
  13: tokio_native_tls::handshake::async_fn$0<tokio_native_tls::impl$12::connect::async_fn$0::closure_env$0<tokio::net::tcp::stream::TcpStream>,tokio::net::tcp::stream::TcpStream>
             at C:\Users\conno\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-native-tls-0.3.1\src\lib.rs:255
  14: tokio_native_tls::impl$12::connect::async_fn$0<tokio::net::tcp::stream::TcpStream>
             at C:\Users\conno\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-native-tls-0.3.1\src\lib.rs:311
  15: hyper_tls::client::impl$5::call::async_block$1<hyper::client::connect::http::HttpConnector<reqwest::dns::resolve::DynResolver> >
             at C:\Users\conno\.cargo\registry\src\index.crates.io-6f17d22bba15001f\hyper-tls-0.5.0\src\client.rs:138  
  16: core::future::future::impl$1::poll<alloc::boxed::Box<dyn$<core::future::future::Future<assoc$<Output,enum2$<core::result::Result<enum2$<hyper_tls::stream::MaybeHttpsStream<tokio::net::tcp::stream::TcpStream> >,alloc::boxed::Box<dyn$<core::error::Error,cor
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6\library\core\src\future\future.rs:123
  17: hyper_tls::client::impl$6::poll<tokio::net::tcp::stream::TcpStream>
             at C:\Users\conno\.cargo\registry\src\index.crates.io-6f17d22bba15001f\hyper-tls-0.5.0\src\client.rs:162  
  18: reqwest::connect::impl$0::connect_with_maybe_proxy::async_fn$0
             at C:\Users\conno\.cargo\registry\src\index.crates.io-6f17d22bba15001f\reqwest-0.11.22\src\connect.rs:258 
  19: reqwest::connect::with_timeout::async_fn$0<reqwest::connect::Conn,enum2$<reqwest::connect::impl$0::connect_with_maybe_proxy::async_fn_env$0> >
             at C:\Users\conno\.cargo\registry\src\index.crates.io-6f17d22bba15001f\reqwest-0.11.22\src\connect.rs:432 
  20: core::future::future::impl$1::poll<alloc::boxed::Box<dyn$<core::future::future::Future<assoc$<Output,enum2$<core::result::Result<reqwest::connect::Conn,alloc::boxed::Box<dyn$<core::error::Error,core::marker::Send,core::marker::Sync>,alloc::alloc::Global>
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6\library\core\src\future\future.rs:123
  21: hyper::service::oneshot::impl$0::poll<reqwest::connect::Connector,http::uri::Uri>
             at C:\Users\conno\.cargo\registry\src\index.crates.io-6f17d22bba15001f\hyper-0.14.26\src\service\oneshot.rs:60
  22: futures_core::future::impl$2::try_poll<hyper::service::oneshot::Oneshot<reqwest::connect::Connector,http::uri::Uri>,reqwest::connect::Conn,alloc::boxed::Box<dyn$<core::error::Error,core::marker::Send,core::marker::Sync>,alloc::alloc::Global> >
             at C:\Users\conno\.cargo\registry\src\index.crates.io-6f17d22bba15001f\futures-core-0.3.28\src\future.rs:82
  23: futures_util::future::try_future::into_future::impl$2::poll<hyper::service::oneshot::Oneshot<reqwest::connect::Connector,http::uri::Uri> >
             at C:\Users\conno\.cargo\registry\src\index.crates.io-6f17d22bba15001f\futures-util-0.3.28\src\future\try_future\into_future.rs:34
  24: futures_util::future::future::map::impl$2::poll<futures_util::future::try_future::into_future::IntoFuture<hyper::service::oneshot::Oneshot<reqwest::connect::Connector,http::uri::Uri> >,futures_util::fns::MapErrFn<hyper::error::Error (*)(alloc::boxed::Box<
             at C:\Users\conno\.cargo\registry\src\index.crates.io-6f17d22bba15001f\futures-util-0.3.28\src\future\future\map.rs:55
  25: futures_util::future::future::impl$15::poll<futures_util::future::try_future::into_future::IntoFuture<hyper::service::oneshot::Oneshot<reqwest::connect::Connector,http::uri::Uri> >,futures_util::fns::MapErrFn<hyper::error::Error (*)(alloc::boxed::Box<dyn$
             at C:\Users\conno\.cargo\registry\src\index.crates.io-6f17d22bba15001f\futures-util-0.3.28\src\lib.rs:91  
  26: futures_util::future::try_future::impl$61::poll<hyper::service::oneshot::Oneshot<reqwest::connect::Connector,http::uri::Uri>,hyper::error::Error (*)(alloc::boxed::Box<dyn$<core::error::Error,core::marker::Send,core::marker::Sync>,alloc::alloc::Global>)>
             at C:\Users\conno\.cargo\registry\src\index.crates.io-6f17d22bba15001f\futures-util-0.3.28\src\lib.rs:91  
  27: futures_core::future::impl$2::try_poll<futures_util::future::try_future::MapErr<hyper::service::oneshot::Oneshot<reqwest::connect::Connector,http::uri::Uri>,hyper::error::Error (*)(alloc::boxed::Box<dyn$<core::error::Error,core::marker::Send,core::marker:
             at C:\Users\conno\.cargo\registry\src\index.crates.io-6f17d22bba15001f\futures-core-0.3.28\src\future.rs:82
  28: futures_util::future::try_future::into_future::impl$2::poll<futures_util::future::try_future::MapErr<hyper::service::oneshot::Oneshot<reqwest::connect::Connector,http::uri::Uri>,hyper::error::Error (*)(alloc::boxed::Box<dyn$<core::error::Error,core::marke
             at C:\Users\conno\.cargo\registry\src\index.crates.io-6f17d22bba15001f\futures-util-0.3.28\src\future\try_future\into_future.rs:34
  29: futures_util::future::future::map::impl$2::poll<futures_util::future::try_future::into_future::IntoFuture<futures_util::future::try_future::MapErr<hyper::service::oneshot::Oneshot<reqwest::connect::Connector,http::uri::Uri>,hyper::error::Error (*)(alloc::
             at C:\Users\conno\.cargo\registry\src\index.crates.io-6f17d22bba15001f\futures-util-0.3.28\src\future\future\map.rs:55
  30: futures_util::future::future::impl$15::poll<futures_util::future::try_future::into_future::IntoFuture<futures_util::future::try_future::MapErr<hyper::service::oneshot::Oneshot<reqwest::connect::Connector,http::uri::Uri>,hyper::error::Error (*)(alloc::boxe
             at C:\Users\conno\.cargo\registry\src\index.crates.io-6f17d22bba15001f\futures-util-0.3.28\src\lib.rs:91  
  31: futures_util::future::try_future::impl$56::poll<futures_util::future::try_future::MapErr<hyper::service::oneshot::Oneshot<reqwest::connect::Connector,http::uri::Uri>,hyper::error::Error (*)(alloc::boxed::Box<dyn$<core::error::Error,core::marker::Send,core
             at C:\Users\conno\.cargo\registry\src\index.crates.io-6f17d22bba15001f\futures-util-0.3.28\src\lib.rs:91  
  32: futures_core::future::impl$2::try_poll<futures_util::future::try_future::MapOk<futures_util::future::try_future::MapErr<hyper::service::oneshot::Oneshot<reqwest::connect::Connector,http::uri::Uri>,hyper::error::Error (*)(alloc::boxed::Box<dyn$<core::error
             at C:\Users\conno\.cargo\registry\src\index.crates.io-6f17d22bba15001f\futures-core-0.3.28\src\future.rs:82
  33: futures_util::future::try_future::try_flatten::impl$2::poll<futures_util::future::try_future::MapOk<futures_util::future::try_future::MapErr<hyper::service::oneshot::Oneshot<reqwest::connect::Connector,http::uri::Uri>,hyper::error::Error (*)(alloc::boxed:
             at C:\Users\conno\.cargo\registry\src\index.crates.io-6f17d22bba15001f\futures-util-0.3.28\src\future\try_future\try_flatten.rs:49
  34: futures_util::future::try_future::impl$4::poll<futures_util::future::try_future::MapOk<futures_util::future::try_future::MapErr<hyper::service::oneshot::Oneshot<reqwest::connect::Connector,http::uri::Uri>,hyper::error::Error (*)(alloc::boxed::Box<dyn$<cor
             at C:\Users\conno\.cargo\registry\src\index.crates.io-6f17d22bba15001f\futures-util-0.3.28\src\lib.rs:91  
  35: futures_util::future::try_future::impl$26::poll<futures_util::future::try_future::MapErr<hyper::service::oneshot::Oneshot<reqwest::connect::Connector,http::uri::Uri>,hyper::error::Error (*)(alloc::boxed::Box<dyn$<core::error::Error,core::marker::Send,core
             at C:\Users\conno\.cargo\registry\src\index.crates.io-6f17d22bba15001f\futures-util-0.3.28\src\lib.rs:91  
  36: futures_util::future::either::impl$4::poll<futures_util::future::try_future::AndThen<futures_util::future::try_future::MapErr<hyper::service::oneshot::Oneshot<reqwest::connect::Connector,http::uri::Uri>,hyper::error::Error (*)(alloc::boxed::Box<dyn$<core:
             at C:\Users\conno\.cargo\registry\src\index.crates.io-6f17d22bba15001f\futures-util-0.3.28\src\future\either.rs:109
  37: hyper::common::lazy::impl$1::poll<hyper::client::client::impl$3::connect_to::closure_env$0<reqwest::connect::Connector,reqwest::async_impl::body::ImplStream>,enum2$<futures_util::future::either::Either<futures_util::future::try_future::AndThen<futures_uti
             at C:\Users\conno\.cargo\registry\src\index.crates.io-6f17d22bba15001f\hyper-0.14.26\src\common\lazy.rs:62
  38: futures_util::future::future::FutureExt::poll_unpin<hyper::common::lazy::Lazy<hyper::client::client::impl$3::connect_to::closure_env$0<reqwest::connect::Connector,reqwest::async_impl::body::ImplStream>,enum2$<futures_util::future::either::Either<futures_u
             at C:\Users\conno\.cargo\registry\src\index.crates.io-6f17d22bba15001f\futures-util-0.3.28\src\future\future\mod.rs:562
  39: futures_util::future::select::impl$1::poll<hyper::client::pool::Checkout<hyper::client::client::PoolClient<reqwest::async_impl::body::ImplStream> >,hyper::common::lazy::Lazy<hyper::client::client::impl$3::connect_to::closure_env$0<reqwest::connect::Connec
             at C:\Users\conno\.cargo\registry\src\index.crates.io-6f17d22bba15001f\futures-util-0.3.28\src\future\select.rs:118
  40: hyper::client::client::impl$3::connection_for::async_fn$0<reqwest::connect::Connector,reqwest::async_impl::body::ImplStream>
             at C:\Users\conno\.cargo\registry\src\index.crates.io-6f17d22bba15001f\hyper-0.14.26\src\client\client.rs:368
  41: hyper::client::client::impl$3::send_request::async_fn$0<reqwest::connect::Connector,reqwest::async_impl::body::ImplStream>
             at C:\Users\conno\.cargo\registry\src\index.crates.io-6f17d22bba15001f\hyper-0.14.26\src\client\client.rs:236
  42: hyper::client::client::impl$3::retryably_send_request::async_fn$0<reqwest::connect::Connector,reqwest::async_impl::body::ImplStream>
             at C:\Users\conno\.cargo\registry\src\index.crates.io-6f17d22bba15001f\hyper-0.14.26\src\client\client.rs:206
  43: hyper::client::client::impl$10::poll
             at C:\Users\conno\.cargo\registry\src\index.crates.io-6f17d22bba15001f\hyper-0.14.26\src\client\client.rs:623
  44: reqwest::async_impl::client::impl$13::poll
             at C:\Users\conno\.cargo\registry\src\index.crates.io-6f17d22bba15001f\reqwest-0.11.22\src\async_impl\client.rs:2263
  45: reqwest::async_impl::client::impl$12::poll
             at C:\Users\conno\.cargo\registry\src\index.crates.io-6f17d22bba15001f\reqwest-0.11.22\src\async_impl\client.rs:2241
  46: cli::auth::get_github_user::async_fn$0
             at .\src\auth.rs:128
  47: cli::auth::impl$2::is_expired::async_fn$0
             at .\src\auth.rs:143
  48: cli::auth::impl$8::maybe_refresh_token::async_fn$0
             at .\src\auth.rs:578
  49: cli::auth::impl$8::get_credential::async_fn$0
             at .\src\auth.rs:508
  50: cli::auth::impl$8::get_tunnel_authentication::async_fn$0
             at .\src\auth.rs:447
  51: cli::auth::impl$18::get_authorization::async_block$0
             at .\src\auth.rs:810
  52: core::future::future::impl$1::poll<alloc::boxed::Box<dyn$<core::future::future::Future<assoc$<Output,enum2$<core::result::Result<enum2$<tunnels::management::authorization::Authorization>,enum2$<tunnels::management::errors::HttpError> > > > >,core::marker:
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6\library\core\src\future\future.rs:123
  53: tunnels::management::http_client::impl$0::make_request::async_fn$0
             at C:\Users\conno\.cargo\git\checkouts\dev-tunnels-99bcc8e49562bf97\8cae9b2\rs\src\management\http_client.rs:474
  54: tunnels::management::http_client::impl$0::make_tunnel_request::async_fn$0
             at C:\Users\conno\.cargo\git\checkouts\dev-tunnels-99bcc8e49562bf97\8cae9b2\rs\src\management\http_client.rs:433
  55: tunnels::management::http_client::impl$0::get_tunnel::async_fn$0
             at C:\Users\conno\.cargo\git\checkouts\dev-tunnels-99bcc8e49562bf97\8cae9b2\rs\src\management\http_client.rs:92
  56: opentelemetry_api::trace::context::impl$4::poll<enum2$<tunnels::management::http_client::impl$0::get_tunnel::async_fn_env$0> >
             at C:\Users\conno\.cargo\registry\src\index.crates.io-6f17d22bba15001f\opentelemetry_api-0.19.0\src\trace\context.rs:373
  57: cli::tunnels::dev_tunnels::impl$4::get_or_create_tunnel::async_fn$0
             at .\src\tunnels\dev_tunnels.rs:443
  58: cli::tunnels::dev_tunnels::impl$4::start_new_launcher_tunnel::async_fn$0
             at .\src\tunnels\dev_tunnels.rs:484
  59: cli::commands::tunnels::serve_with_csa::async_fn$0::closure$3
             at C:\Users\conno\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.28.2\src\macros\select.rs:524
  60: tokio::future::poll_fn::impl$1::poll<enum2$<cli::commands::tunnels::serve_with_csa::async_fn$0::__tokio_select_util::Out<enum2$<core::result::Result<cli::tunnels::dev_tunnels::ActiveTunnel,enum2$<cli::util::errors::AnyError> > >,enum2$<core::result::Resul
             at C:\Users\conno\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.28.2\src\future\poll_fn.rs:58
  61: cli::commands::tunnels::serve_with_csa::async_fn$0
             at .\src\commands\tunnels.rs:602
  62: cli::commands::tunnels::serve::async_fn$0
             at .\src\commands\tunnels.rs:419
  63: code::main::async_block$0
             at .\src\bin\code\main.rs:124
  64: tokio::runtime::park::impl$4::block_on::closure$0<enum2$<code::main::async_block_env$0> >
             at C:\Users\conno\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.28.2\src\runtime\park.rs:283
  65: tokio::runtime::coop::with_budget
             at C:\Users\conno\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.28.2\src\runtime\coop.rs:107
  66: tokio::runtime::coop::budget
             at C:\Users\conno\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.28.2\src\runtime\coop.rs:73
  67: tokio::runtime::park::CachedParkThread::block_on<enum2$<code::main::async_block_env$0> >
  69: tokio::runtime::scheduler::multi_thread::MultiThread::block_on<enum2$<code::main::async_block_env$0> >
             at C:\Users\conno\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.28.2\src\runtime\scheduler\multi_thread\mod.rs:66
  70: tokio::runtime::runtime::Runtime::block_on<enum2$<code::main::async_block_env$0> >
             at C:\Users\conno\.cargo\registry\src\index.crates.io-6f17d22bba15001f\tokio-1.28.2\src\runtime\runtime.rs:304
  71: code::main
             at .\src\bin\code\main.rs:129
  72: core::ops::function::FnOnce::call_once<enum2$<core::result::Result<tuple$<>,enum2$<core::convert::Infallible> > > (*)(),tuple$<> >    
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6\library\core\src\ops\function.rs:250
  73: core::hint::black_box
             at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6\library\core\src\hint.rs:337
timas130 commented 3 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.

Backtrace
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
connor4312 commented 3 months ago

Doesn't happen on release builds at all

Precondition assertions are only enabled by default on debug builds

steffengy commented 3 months ago

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.

kirovj commented 3 months ago

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.

connor4312 commented 3 months ago

Unfortunately we're using 0.1.23 and still see the panic (this is my lockfile)

alloncm commented 1 week ago

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

steffengy commented 1 week ago

Any occurences in recent rust versions and 0.1.24?