Throw IllegalStateException if DynamicChannelBuffer exceed the maximum
ChannelBuffer size of 2gb. See #258
This commit is contained in:
parent
fdc27db45d
commit
8bf84a8737
|
@ -73,6 +73,14 @@ public class DynamicChannelBuffer extends AbstractChannelBuffer {
|
|||
int minNewCapacity = writerIndex() + minWritableBytes;
|
||||
while (newCapacity < minNewCapacity) {
|
||||
newCapacity <<= 1;
|
||||
|
||||
// Check if we exceeded the maximum size of 2gb if this is the case then
|
||||
// newCapacity == 0
|
||||
//
|
||||
// https://github.com/netty/netty/issues/258
|
||||
if (newCapacity == 0) {
|
||||
throw new IllegalStateException("Maximum size of 2gb exceeded");
|
||||
}
|
||||
}
|
||||
|
||||
ChannelBuffer newBuffer = factory().getBuffer(order(), newCapacity);
|
||||
|
|
Loading…
Reference in New Issue
Block a user