You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by st...@apache.org on 2021/05/10 19:47:51 UTC
[hbase] branch branch-2 updated: HBASE-25859 Reference class
incorrectly parses the protobuf magic marker (#3236)
This is an automated email from the ASF dual-hosted git repository.
stack pushed a commit to branch branch-2
in repository https://gitbox.apache.org/repos/asf/hbase.git
The following commit(s) were added to refs/heads/branch-2 by this push:
new 4e507cc HBASE-25859 Reference class incorrectly parses the protobuf magic marker (#3236)
4e507cc is described below
commit 4e507ccda00b1824e7e7530146b1411b57e2690f
Author: Catalin Luca <ca...@gmail.com>
AuthorDate: Mon May 10 22:45:23 2021 +0300
HBASE-25859 Reference class incorrectly parses the protobuf magic marker (#3236)
Co-authored-by: Catalin Luca <lu...@adobe.com>
Signed-off-by: stack <st...@apache.org>
---
.../src/main/java/org/apache/hadoop/hbase/io/Reference.java | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/Reference.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/Reference.java
index 5a03e6c..845005f 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/Reference.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/Reference.java
@@ -25,6 +25,7 @@ import java.io.IOException;
import java.io.InputStream;
import java.util.Arrays;
+import org.apache.commons.io.IOUtils;
import org.apache.yetus.audience.InterfaceAudience;
import org.apache.hadoop.fs.FSDataOutputStream;
import org.apache.hadoop.fs.FileSystem;
@@ -174,10 +175,7 @@ public class Reference {
int pblen = ProtobufUtil.lengthOfPBMagic();
in.mark(pblen);
byte [] pbuf = new byte[pblen];
- int read = in.read(pbuf);
- if (read != pblen) {
- throw new IOException("read=" + read + ", wanted=" + pblen);
- }
+ IOUtils.readFully(in, pbuf,0, pblen);
// WATCHOUT! Return in middle of function!!!
if (ProtobufUtil.isPBMagicPrefix(pbuf)) return convert(FSProtos.Reference.parseFrom(in));
// Else presume Writables. Need to reset the stream since it didn't start w/ pb.