Giter Site home page Giter Site logo

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`" about schannel-rs HOT 5 OPEN

connor4312 avatar connor4312 commented on August 30, 2024 2
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`"

from schannel-rs.

Comments (5)

connor4312 avatar connor4312 commented on August 30, 2024 1

Doesn't happen on release builds at all

Precondition assertions are only enabled by default on debug builds

from schannel-rs.

timas130 avatar timas130 commented on August 30, 2024

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

from schannel-rs.

steffengy avatar steffengy commented on August 30, 2024

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.

from schannel-rs.

kirovj avatar kirovj commented on August 30, 2024

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.

from schannel-rs.

connor4312 avatar connor4312 commented on August 30, 2024

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

from schannel-rs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.