-
Notifications
You must be signed in to change notification settings - Fork 929
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IPv6 endpoint passed through the URL will crash #1696
Comments
gezihuzi
changed the title
通过URL 传入的Ipv6 端点将会引发崩溃
IPv6 endpoint passed through the URL will cause a crash.
May 3, 2024
gezihuzi
changed the title
IPv6 endpoint passed through the URL will cause a crash.
IPv6 endpoint passed through the URL will crash
May 3, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bug Report
Version
Platform
Darwin Chen.local 23.4.0 Darwin Kernel Version 23.4.0: Fri Mar 15 00:10:42 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6000 arm64
Description
When I make a request to an local IPv6 endpoint using this code, the program crashes.
I found that the
IpAddr
cannot be parsed correctly because the parameter passed in when resolving the service address was not processed at all.In the source code of
tonic
:tonic/tonic/src/transport/channel/tls.rs
Lines 72 to 83 in 068421a
The code here directly obtains the corresponding domain information through
uri.host()
. Then it is passed intoTlsConnector::new
.After passing in the parameters, construct
TlsConnector
:tonic/tonic/src/transport/service/tls.rs
Lines 37 to 71 in 068421a
In line 68 of the code, construct
ServerName
by passing parameters throughServerName::try_from
. It crashes here.The reason is that the domain information obtained by
uri.host()
includes[
and]
, which prevents the IPv6 address from being resolved correctly here.The text was updated successfully, but these errors were encountered: