hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chia7...@apache.org
Subject hbase git commit: HBASE-18112 (addendum) fix the out-of-bounds index
Date Wed, 06 Dec 2017 14:06:33 GMT
Repository: hbase
Updated Branches:
  refs/heads/master 75cdbb570 -> ebd8841e0


HBASE-18112 (addendum) fix the out-of-bounds index


Project: http://git-wip-us.apache.org/repos/asf/hbase/repo
Commit: http://git-wip-us.apache.org/repos/asf/hbase/commit/ebd8841e
Tree: http://git-wip-us.apache.org/repos/asf/hbase/tree/ebd8841e
Diff: http://git-wip-us.apache.org/repos/asf/hbase/diff/ebd8841e

Branch: refs/heads/master
Commit: ebd8841e0ee9ca1ab7b6dab55178761360b8d85a
Parents: 75cdbb5
Author: Chia-Ping Tsai <chia7712@gmail.com>
Authored: Wed Dec 6 21:54:45 2017 +0800
Committer: Chia-Ping Tsai <chia7712@gmail.com>
Committed: Wed Dec 6 21:54:45 2017 +0800

----------------------------------------------------------------------
 .../org/apache/hadoop/hbase/ipc/NettyRpcFrameDecoder.java    | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hbase/blob/ebd8841e/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcFrameDecoder.java
----------------------------------------------------------------------
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcFrameDecoder.java
b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcFrameDecoder.java
index d600712..1b395a4 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcFrameDecoder.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/ipc/NettyRpcFrameDecoder.java
@@ -95,18 +95,14 @@ public class NettyRpcFrameDecoder extends ByteToMessageDecoder {
     }
 
     int frameLengthInt = (int) frameLength;
-    if (in.readableBytes() < frameLengthInt) {
+    if (in.readableBytes() < frameLengthInt + FRAME_LENGTH_FIELD_LENGTH) {
       return;
     }
 
     in.skipBytes(FRAME_LENGTH_FIELD_LENGTH);
 
     // extract frame
-    int readerIndex = in.readerIndex();
-    ByteBuf frame = in.retainedSlice(readerIndex, frameLengthInt);
-    in.readerIndex(readerIndex + frameLengthInt);
-
-    out.add(frame);
+    out.add(in.readRetainedSlice(frameLengthInt));
   }
 
   private void handleTooBigRequest(ByteBuf in) throws IOException {


Mime
View raw message