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

This commit is contained in:
Chia-Ping Tsai 2017-12-06 21:54:45 +08:00
parent 75cdbb5700
commit ebd8841e0e
1 changed files with 2 additions and 6 deletions

View File

@ -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 {