fuyou001 commented on PR #10691: URL: https://github.com/apache/rocketmq/pull/10691#issuecomment-5128557476
[P1] The malformed-port handling is incomplete for out-of-range values. The new catch handles `NumberFormatException`, but values such as `127.0.0.1:-1` and `127.0.0.1:65536` parse successfully as integers and then cause the `InetSocketAddress` constructor to throw `IllegalArgumentException`. Consequently, `remoteAddress()` and `localAddress()` can still throw for malformed ports instead of returning `null` as described by this PR. Please validate the parsed port explicitly as `0..65535` before constructing the address (preferable for clear semantics), or otherwise handle the constructor exception as invalid input. Please add assertions for `-1`, `65536`, a value larger than `Integer.MAX_VALUE`, an empty port, and whitespace, covering both `remoteAddress()` and `localAddress()`. It would also be useful to exercise the callers in `LocalProxyRelayService`, `ChannelManager`, `ContextInitPipeline`, and `RemotingChannel` so that a `null` address and an asynchronously completed relay callback are consumed safely. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
