From 7fa20dcb07efed2c8adbb0b32c6f17e1a1b60b27 Mon Sep 17 00:00:00 2001 From: Trustin Lee Date: Tue, 6 Jan 2009 05:20:16 +0000 Subject: [PATCH] Made sure corrupted frame data is skipped --- .../netty/handler/codec/frame/LengthFieldBasedFrameDecoder.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/main/java/org/jboss/netty/handler/codec/frame/LengthFieldBasedFrameDecoder.java b/src/main/java/org/jboss/netty/handler/codec/frame/LengthFieldBasedFrameDecoder.java index f6499275fa..5552d62ddc 100644 --- a/src/main/java/org/jboss/netty/handler/codec/frame/LengthFieldBasedFrameDecoder.java +++ b/src/main/java/org/jboss/netty/handler/codec/frame/LengthFieldBasedFrameDecoder.java @@ -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);