Konstantin Orlov created IGNITE-19794:
-----------------------------------------
Summary: Thin 3.0: ClientMessagePacker packs binary incorrect
tuples
Key: IGNITE-19794
URL: https://issues.apache.org/jira/browse/IGNITE-19794
Project: Ignite
Issue Type: Bug
Components: thin client
Reporter: Konstantin Orlov
Attachments: corrupted_tuple_test.patch
Take a look at the method:
{code:java}
// org.apache.ignite.internal.client.proto.ClientMessagePacker
public void packBinaryTuple(BinaryTupleReader binaryTupleReader, int
elementCount) {
ByteBuffer buf = binaryTupleReader.byteBuffer();
int len = buf.limit() - buf.position();
if (elementCount > -1) {
binaryTupleReader.seek(elementCount - 1);
len = binaryTupleReader.end();
buf.limit(len + buf.position());
}
packBinaryHeader(len);
writePayload(buf);
}
{code}
If {{elementCount}} is provided (> -1), tuple will be truncated up to the
element with index {{elementCount - 1}}. A truncated tuple, although retaining
logical equality, is not binary equal to the same tuple, but correctly
assembled, since neither offset table nor null map are adjusted.
Because {{ClientMessagePacker}} is a general purpose library to implement
protocol between client and server, such behaviour is rather dangerous and
should be fixed.
In the attachment there is a test that highlights the problem.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)