This is an automated email from the ASF dual-hosted git repository.
zhangduo pushed a commit to branch branch-3
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-3 by this push:
new d74583c8ebe HBASE-28101 Should check the return value of protobuf
Message.mergeDelimitedFrom (#5413)
d74583c8ebe is described below
commit d74583c8ebebc93a4198f61bbd9b9723a3de9e28
Author: Duo Zhang <[email protected]>
AuthorDate: Wed Sep 20 21:39:16 2023 +0800
HBASE-28101 Should check the return value of protobuf
Message.mergeDelimitedFrom (#5413)
Signed-off-by: GeorryHuang <[email protected]>
(cherry picked from commit 93d90bf64d6dfbdfbdd712f2748857ae282a3014)
---
.../java/org/apache/hadoop/hbase/ipc/NettyRpcDuplexHandler.java | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git
a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcDuplexHandler.java
b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcDuplexHandler.java
index 700093a3027..34869314bab 100644
---
a/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcDuplexHandler.java
+++
b/hbase-client/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcDuplexHandler.java
@@ -18,6 +18,7 @@
package org.apache.hadoop.hbase.ipc;
import io.opentelemetry.context.Scope;
+import java.io.EOFException;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
@@ -168,7 +169,12 @@ class NettyRpcDuplexHandler extends ChannelDuplexHandler {
Message value;
if (call.responseDefaultType != null) {
Message.Builder builder = call.responseDefaultType.newBuilderForType();
- builder.mergeDelimitedFrom(in);
+ if (!builder.mergeDelimitedFrom(in)) {
+ // The javadoc of mergeDelimitedFrom says returning false means the
stream reaches EOF
+ // before reading any bytes out, so here we need to manually throw the
EOFException out
+ throw new EOFException(
+ "EOF while reading response with type: " +
call.responseDefaultType.getClass().getName());
+ }
value = builder.build();
} else {
value = null;