From d5c1c01f67f06067f06e12f205851d1c03cdbf15 Mon Sep 17 00:00:00 2001 From: Andrey Saranchin Date: Tue, 15 Oct 2024 21:23:58 +0300 Subject: [PATCH] buffer: allow to read zero bytes 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. --- src/Buffer/Buffer.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Buffer/Buffer.hpp b/src/Buffer/Buffer.hpp index 647b121ba..459af3335 100644 --- a/src/Buffer/Buffer.hpp +++ b/src/Buffer/Buffer.hpp @@ -1238,7 +1238,8 @@ template void Buffer::iterator_common::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.