[#4635] Stop decoding if decoder was removed in ReplayingDecoder

We need to check if this handler was removed before continuing with decoding.
If it was removed, it is not safe to continue to operate on the buffer. This was already fixed for ByteToMessageDecoder in 4cdbe39284  but missed for ReplayingDecoder.

Modifications:

Check if decoder was removed after fire messages through the pipeline.

Result:

No illegal buffer access when decoder was removed.
This commit is contained in:
Norman Maurer 2016-04-11 10:15:19 +02:00
parent e3aced62ed
commit 8d3ef3a80e

View File

@ -367,6 +367,15 @@ public abstract class ReplayingDecoder<S> extends ByteToMessageDecoder {
if (outSize > 0) {
fireChannelRead(ctx, out, outSize);
out.clear();
// Check if this handler was removed before continuing with decoding.
// If it was removed, it is not safe to continue to operate on the buffer.
//
// See:
// - https://github.com/netty/netty/issues/4635
if (ctx.isRemoved()) {
break;
}
outSize = 0;
}