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 287a02dc05)
This commit is contained in:
Piotr Sarna
2019-03-26 10:38:17 +01:00
committed by Avi Kivity
parent 68b54b2e52
commit 5ec646cb4e

View File

@@ -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) {