Comments (5)
Doesn't happen on release builds at all
Precondition assertions are only enabled by default on debug builds
from schannel-rs.
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.
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.
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.
Unfortunately we're using 0.1.23 and still see the panic (this is my lockfile)
from schannel-rs.
Related Issues (20)
- Provide access to the underlying Windows handles HOT 1
- open_local_machine & open_current_user cannot be specified as read-only HOT 7
- Question: how do I use PrivateKey? HOT 7
- Question: wincrypt APIs are now deprecated, any new crates using CNG?
- Interface changes to support RFC 5077 TLS session tickets HOT 5
- Bump version ? HOT 1
- Version bump sometime soon? HOT 1
- Switch to official Microsoft-owned windows-rs crate HOT 3
- Soundness: CertStore and CertContext `Send` and `Clone` are mutually exclusive
- Question: why NCRYPT_KEY_HANDLE is private? HOT 2
- TLS negotiation fails when `schannel` (via `native_tls`) tries to connect to an OpenSSL 3 server HOT 3
- TlsStream server is busy-waiting if TLS handshake is delayed by client
- Support for Mutual TLS
- Example importing key into cert store
- Strange handshake errors when running multiple TLS servers on the same machine (through rust-native-tls) HOT 1
- PfxImportOptions::import() creates ncrypt key in file system that is not deleted when program exits
- tls 1.3 issue
- Panic at ContextBuffer::deref
- Getting the private key for a certificate as a PEM-formatted String
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from schannel-rs.