This is an automated email from the ASF dual-hosted git repository.
JackieTien97 pushed a commit to branch dev/1.3
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/dev/1.3 by this push:
new 8dc2e37708f [To dev/1.3] Refuse unreasonable string length in thrift
frame
8dc2e37708f is described below
commit 8dc2e37708fc5d3803533d6d8967b11b6977f4ac
Author: Jackie Tien <[email protected]>
AuthorDate: Thu May 7 15:52:40 2026 +0800
[To dev/1.3] Refuse unreasonable string length in thrift frame
(cherry picked from commit f5fbaa2a3c9da6743a06e07fa680fe3714a89b14)
---
.../org/apache/iotdb/rpc/TElasticFramedTransport.java | 18 +++++++++++++-----
1 file changed, 13 insertions(+), 5 deletions(-)
diff --git
a/iotdb-client/service-rpc/src/main/java/org/apache/iotdb/rpc/TElasticFramedTransport.java
b/iotdb-client/service-rpc/src/main/java/org/apache/iotdb/rpc/TElasticFramedTransport.java
index 2524e8ae4cd..40811a00f41 100644
---
a/iotdb-client/service-rpc/src/main/java/org/apache/iotdb/rpc/TElasticFramedTransport.java
+++
b/iotdb-client/service-rpc/src/main/java/org/apache/iotdb/rpc/TElasticFramedTransport.java
@@ -224,7 +224,8 @@ public class TElasticFramedTransport extends TTransport {
+ "requests%s to the Non-SSL Thrift-RPC port, please confirm that
you are using "
+ "the right configuration"),
NEGATIVE_FRAME_SIZE("Read a negative frame size (%d)%s!"),
- FRAME_SIZE_EXCEEDED("Frame size (%d) larger than protect max size
(%d)%s!");
+ FRAME_SIZE_EXCEEDED("Frame size (%d) larger than protect max size
(%d)%s!"),
+ STRING_LENGTH_EXCEEDED("String length (%d) larger than protect max size
(%d)%s!");
private final String messageFormat;
@@ -232,9 +233,9 @@ public class TElasticFramedTransport extends TTransport {
this.messageFormat = messageFormat;
}
- void throwException(int size, String remoteInfo, int maxSize) throws
TTransportException {
+ void throwException(long size, String remoteInfo, int maxSize) throws
TTransportException {
String message =
- (this == FRAME_SIZE_EXCEEDED)
+ (this == FRAME_SIZE_EXCEEDED || this == STRING_LENGTH_EXCEEDED)
? String.format(messageFormat, size, maxSize, remoteInfo)
: String.format(messageFormat, size, remoteInfo);
throw new TTransportException(TTransportException.CORRUPTED_DATA,
message);
@@ -277,8 +278,15 @@ public class TElasticFramedTransport extends TTransport {
@Override
public void checkReadBytesAvailable(long numBytes) throws
TTransportException {
- // do nothing now.
- // here we can do some checkm, e.g., see whether the memory is enough.
+ if (numBytes >= thriftMaxFrameSize) {
+ SocketAddress remoteAddress = null;
+ if (underlying instanceof TSocket) {
+ remoteAddress = ((TSocket)
underlying).getSocket().getRemoteSocketAddress();
+ }
+ String remoteInfo = (remoteAddress == null) ? "" : " from " +
remoteAddress;
+ close();
+ FrameError.STRING_LENGTH_EXCEEDED.throwException(numBytes, remoteInfo,
thriftMaxFrameSize);
+ }
}
@Override