aajisaka commented on code in PR #58909:
URL: https://github.com/apache/spark/pull/58909#discussion_r4068790377


##########
common/network-common/src/main/java/org/apache/spark/network/crypto/GcmTransportCipher.java:
##########
@@ -442,8 +444,13 @@ public void channelRead(ChannelHandlerContext ctx, Object 
ciphertextMessage)
                         int readableBytes = Math.min(
                                 nettyBufReadableBytes,
                                 ciphertextBuffer.remaining());
-                        int expectedRemaining = (int) (expectedLength - 
ciphertextRead);
-                        int bytesToRead = Math.min(readableBytes, 
expectedRemaining);
+                        long expectedRemaining = expectedLength - 
ciphertextRead;
+                        if (expectedRemaining <= 0) {
+                            throw new IllegalStateException(
+                                    "Invalid ciphertext state: 
expectedLength=" + expectedLength
+                                            + ", ciphertextRead=" + 
ciphertextRead);
+                        }

Review Comment:
   Thank you. It's not reachable, so I will remove this.



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to