Made sure corrupted frame data is skipped

This commit is contained in:
Trustin Lee 2009-01-06 05:20:16 +00:00
parent 7ea187df89
commit 7fa20dcb07

View File

@ -124,12 +124,14 @@ public class LengthFieldBasedFrameDecoder extends FrameDecoder {
}
if (frameLength < 0) {
buffer.skipBytes(actualLengthFieldOffset + lengthFieldLength);
throw new CorruptedFrameException(
"negative pre-adjustment length field: " + frameLength);
}
frameLength += lengthAdjustment + lengthFieldEndOffset;
if (frameLength < lengthFieldEndOffset) {
buffer.skipBytes(actualLengthFieldOffset + lengthFieldLength);
throw new CorruptedFrameException(
"Adjusted length (" + frameLength + ") is less than " +
lengthFieldEndOffset);