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

Ignite TC Bot commented on IGNITE-23598:
----------------------------------------

{panel:title=Branch: [pull/11777/head] Base: [master] : Possible Blockers 
(1)|borderStyle=dashed|borderColor=#ccc|titleBGColor=#F7D6C1}
{color:#d04437}[Check Code Style Ducktests]{color} [[tests 0 Exit Code 
|https://ci.ignite.apache.org/viewLog.html?buildId=8734650]]

{panel}
{panel:title=Branch: [pull/11777/head] Base: [master] : New Tests 
(3)|borderStyle=dashed|borderColor=#ccc|titleBGColor=#D6F7C1}
{color:#00008b}Platform C++ CMake (Linux Clang){color} [[tests 
1|https://ci.ignite.apache.org/viewLog.html?buildId=8734796]]
* {color:#013220}IgniteThinClientTest: NetworkCodecTestSuite: 
LengthPrefixCodec_3bytes - PASSED{color}

{color:#00008b}Platform C++ CMake (Win x64 / Release){color} [[tests 
1|https://ci.ignite.apache.org/viewLog.html?buildId=8734227]]
* {color:#013220}IgniteThinClientTest: NetworkCodecTestSuite: 
LengthPrefixCodec_3bytes - PASSED{color}

{color:#00008b}Platform C++ CMake (Linux){color} [[tests 
1|https://ci.ignite.apache.org/viewLog.html?buildId=8758409]]
* {color:#013220}IgniteThinClientTest: NetworkCodecTestSuite: 
LengthPrefixCodec_3bytes - PASSED{color}

{panel}
[TeamCity *-> Run :: CPP* 
Results|https://ci.ignite.apache.org/viewLog.html?buildId=8734230&buildTypeId=IgniteTests24Java8_RunCpp]

> CPP: Network module LengthPrefixCodec has a bug
> -----------------------------------------------
>
>                 Key: IGNITE-23598
>                 URL: https://issues.apache.org/jira/browse/IGNITE-23598
>             Project: Ignite
>          Issue Type: Bug
>          Components: odbc, platforms, thin client
>    Affects Versions: 2.16
>            Reporter: Igor Sapego
>            Assignee: Igor Sapego
>            Priority: Major
>          Time Spent: 50m
>  Remaining Estimate: 0h
>
> The bug was originally reported at GitHub by https://github.com/morphad 
> (https://github.com/apache/ignite/issues/11524).
> Apparently, there is a bug in LengthPrefixCodec::Decode function, in file 
> modules/platforms/cpp/network/src/network/length_prefix_codec.cpp
> # A call of LengthPrefixCodec::Decode with data length of 3, the packetSize 
> reset to -1, and the packet length will be 3;
> # The following call, will enter first if, and the packet length of 3 reset 
> to 0, the packet last 3 byte data will be lost.
> {code:cpp}
> DataBuffer LengthPrefixCodec::Decode(DataBuffer& data)
> {
>   if (packet.IsValid() && packet.Get()->Length() == (PACKET_HEADER_SIZE + 
> packetSize))
>   {
>     packetSize = -1;
>     packet.Get()->Length(0);
>   }
>   if (packetSize < 0)
>   {
>     Consume(data, PACKET_HEADER_SIZE);
>     if (packet.Get()->Length() < PACKET_HEADER_SIZE)
>       return DataBuffer();
>     packetSize = impl::binary::BinaryUtils::ReadInt32(*packet.Get(), 0);
>   }
>   Consume(data, PACKET_HEADER_SIZE + packetSize);
>   if (packet.Get()->Length() == (PACKET_HEADER_SIZE + packetSize))
>     return DataBuffer(packet, 0, PACKET_HEADER_SIZE + packetSize);
>   return DataBuffer();
> }
> {code}
> Can be fixed like this:
> {code:cpp}
> DataBuffer LengthPrefixCodec::Decode(DataBuffer& data)
> {
>   if (packet.IsValid() && packetSize != -1 && packet.Get()->Length() == 
> (PACKET_HEADER_SIZE + packetSize))
>   {
>     packetSize = -1;
>     packet.Get()->Length(0);
>   }
>   ...
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to