netty5/buffer/src
Nick Hill 727f03755c Fix BufferOverflowException during non-Unsafe PooledDirectByteBuf resize (#9912)
Motivation

Recent optimization #9765 introduced a bug where the native indices of
the internal reused duplicate nio buffer are not properly reset prior to
using it to copy data during a reallocation operation. This can result
in BufferOverflowExceptions thrown during ByteBuf capacity changes.

The code path in question applies only to pooled direct buffers when
Unsafe is disabled or not available.

Modification

Ensure ByteBuffer#clear() is always called on the reused internal nio
buffer prior to returning it from PooledByteBuf#internalNioBuffer()
(protected method); add unit test that exposes the bug.

Result

Fixes #9911
2020-01-11 06:05:32 +01:00
..
main Fix BufferOverflowException during non-Unsafe PooledDirectByteBuf resize (#9912) 2020-01-11 06:05:32 +01:00
test/java/io/netty/buffer Fix BufferOverflowException during non-Unsafe PooledDirectByteBuf resize (#9912) 2020-01-11 06:05:32 +01:00