HBASE-18112 (addendum) fix the out-of-bounds index
This commit is contained in:
parent
03cb581585
commit
b9f1f5a17c
|
@ -95,18 +95,14 @@ public class NettyRpcFrameDecoder extends ByteToMessageDecoder {
|
||||||
}
|
}
|
||||||
|
|
||||||
int frameLengthInt = (int) frameLength;
|
int frameLengthInt = (int) frameLength;
|
||||||
if (in.readableBytes() < frameLengthInt) {
|
if (in.readableBytes() < frameLengthInt + FRAME_LENGTH_FIELD_LENGTH) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
in.skipBytes(FRAME_LENGTH_FIELD_LENGTH);
|
in.skipBytes(FRAME_LENGTH_FIELD_LENGTH);
|
||||||
|
|
||||||
// extract frame
|
// extract frame
|
||||||
int readerIndex = in.readerIndex();
|
out.add(in.readRetainedSlice(frameLengthInt));
|
||||||
ByteBuf frame = in.retainedSlice(readerIndex, frameLengthInt);
|
|
||||||
in.readerIndex(readerIndex + frameLengthInt);
|
|
||||||
|
|
||||||
out.add(frame);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void handleTooBigRequest(ByteBuf in) throws IOException {
|
private void handleTooBigRequest(ByteBuf in) throws IOException {
|
||||||
|
|
Loading…
Reference in New Issue