From 5ec646cb4e2a86bdd46ce46cafb6b5a37de80ec6 Mon Sep 17 00:00:00 2001 From: Piotr Sarna Date: Tue, 26 Mar 2019 10:38:17 +0100 Subject: [PATCH] types: fix varint and decimal serialization Varint and decimal types serialization did not update the output iterator after generating a value, which may lead to corrupted sstables - variable-length integers were properly serialized, but if anything followed them directly in the buffer (e.g. in a tuple), their value will be overwritten. Fixes #4348 Tests: unit (dev) dtest: json_test.FromJsonUpdateTests.complex_data_types_test json_test.FromJsonInsertTests.complex_data_types_test json_test.ToJsonSelectTests.complex_data_types_test Note that dtests still do not succeed 100% due to formatting differences in compared results (e.g. 1.0e+07 vs 1.0E7, but it's no longer a query correctness issue. (cherry picked from commit 287a02dc05339df92496359fc9b44c8252343ee9) --- types.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types.cc b/types.cc index 526339f503..70d0e567c2 100644 --- a/types.cc +++ b/types.cc @@ -1478,7 +1478,7 @@ public: } b.push_back(v); } - std::copy(b.crbegin(), b.crend(), out); + out = std::copy(b.crbegin(), b.crend(), out); } virtual size_t serialized_size(const void* value) const override { if (!value) {