[ 
https://issues.apache.org/jira/browse/IGNITE-19794?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17740327#comment-17740327
 ] 

Igor Sapego commented on IGNITE-19794:
--------------------------------------

Looks good to me.

> 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
>            Assignee: Pavel Tupitsyn
>            Priority: Minor
>              Labels: ignite-3
>             Fix For: 3.0.0-beta2
>
>         Attachments: corrupted_tuple_test.patch
>
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> 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)

Reply via email to