-
Notifications
You must be signed in to change notification settings - Fork 147
GH-1271: [Flight] Reject port 0 in NettyClientBuilder #1282
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -140,9 +140,9 @@ public NettyChannelBuilder build() { | |
| case LocationSchemes.GRPC_TLS: | ||
| { | ||
| final int port = location.getUri().getPort(); | ||
| if (port < 0 || port > 65535) { | ||
| if (port < 1 || port > 65535) { | ||
| throw new IllegalArgumentException( | ||
| "Invalid port " + port + ": must be between 0 and 65535."); | ||
| "Invalid port " + port + ": must be between 1 and 65535."); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This narrows the accepted input range of published public API: The change itself is right, but neither Could we add an |
||
| } | ||
| builder = NettyChannelBuilder.forAddress(location.getUri().getHost(), port); | ||
| break; | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
URI.getPort()returns-1to mean "no port present in the URI", not "the user asked for port -1".Folding it into this range check produces
Invalid port -1: must be between 1 and 65535(a number that the user never defined).That path is reachable: a
Locationlikegrpc+tls://myhostwith no port, and alsoArrowFlightSqlClientHandler.getStreams(), which doeswithPort(endpointUri.getPort())on an endpoint URI that may carry no port.Since this PR is rewriting the message anyway, this seems like the moment to split
the two cases: