fishy commented on code in PR #3784:
URL: https://github.com/apache/thrift/pull/3784#discussion_r3915930711
##########
lib/java/src/main/java/org/apache/thrift/async/TAsyncMethodCall.java:
##########
@@ -254,8 +254,25 @@ private void doReadingResponseSize() throws
TTransportException {
throw new TTransportException(TTransportException.END_OF_FILE, "Read
call frame size failed");
}
if (sizeBuffer.remaining() == 0) {
+ // The peer chose this number, and it sizes the buffer below before any
of
+ // the response has arrived. Refuse what TFramedTransport.readFrame
refuses,
+ // so that the two ways of reading a framed response agree.
+ int size = TFramedTransport.decodeFrameSize(sizeBufferArray);
+ if (size < 0) {
+ throw new TTransportException(
+ TTransportException.CORRUPTED_DATA, "Read a negative frame size ("
+ size + ")!");
+ }
+ if (size > transport.getMaxFrameSize()) {
+ throw new TTransportException(
+ TTransportException.CORRUPTED_DATA,
Review Comment:
is `CORRUPTED_DATA` newly added recently? in Go's implementation we are
using `UNKNOWN_TRANSPORT_EXCEPTION` for this one (and there's no
`CORRUPTED_DATA` defined)
--
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]