Skip to content

Commit

Permalink
buffer: allow to read zero bytes
Browse files Browse the repository at this point in the history
Decoder can try to read zero bytes sometimes. For example, when
it received an empty string. Let's simply handle this case in buffer
instead of assertion.

By the way, `ClientTest.cpp` was failing with Tarantool 3.2 because of
this problem: when connector tries to call a non-existing function
(`*** TEST CASE call wrong function ***`), Tarantool sends an empty
string in response.
  • Loading branch information
drewdzzz committed Oct 15, 2024
1 parent ffd5243 commit b17e60b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Buffer/Buffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1238,7 +1238,8 @@ template <bool LIGHT>
void
Buffer<N, allocator>::iterator_common<LIGHT>::read(RData data)
{
assert(data.size > 0);
if (data.size == 0)
return;
/*
* The same implementation as in ::set() method buf vice versa:
* buffer and data sources are swapped.
Expand Down

0 comments on commit b17e60b

Please sign in to comment.