Details
-
Bug
-
Status: Resolved
-
Blocker
-
Resolution: Fixed
-
None
-
None
Description
The code generated for write looks like:
_writable.writeUnsignedVarint(0);
_writable.writeUnsignedVarint(this.classicMemberMetadata.size(_cache, _version, _context) + 1);
_writable.writeUnsignedVarint(1);
classicMemberMetadata.write(_writable, _cache, _version, _context);
while the code generated for addSize looks like:
_size.addBytes(1); _size.addBytes(1); int _sizeBeforeStruct = _size.totalSize(); this.classicMemberMetadata.addSize(_size, _cache, _version, _context); int _structSize = _size.totalSize() - _sizeBeforeStruct; _size.addBytes(ByteUtils.sizeOfUnsignedVarint(_structSize)); // missing a `+ 1`
This becomes a problem when the serialized size of the ClassicMemberMetadata is exactly 127 bytes, since the varint representations of 127 and 128 have different lengths.
In practice this bug causes java.nio.BufferOverflowException s when using the new consumer protocol.
Attachments
Issue Links
- links to