I think we cannot always return `buffer.array()` since it just returns the
backing byte array of this ByteBuffer, and since multiple ByteBuffer may
potentially sits on the same byte array, this `array()` may actually be much
larger than the ByteBuffer's capacity. To be safer we need to do sth. in the
`ByteBufferSerializer`:
```
if (data.hasArray()) {
byte[] arr = data.array();
if (data.arrayOffset() == 0 && arr.length == data.remaining()) {
return arr;
}
}
byte[] ret = new byte[data.remaining()];
data.get(ret, 0, ret.length);
data.rewind();
return ret;
```
[ Full content available at: https://github.com/apache/kafka/pull/5687 ]
This message was relayed via gitbox.apache.org for [email protected]