Skip to content

Commit

Permalink
types: fix varint and decimal serialization
Browse files Browse the repository at this point in the history
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 287a02d)
  • Loading branch information
psarna authored and avikivity committed Mar 26, 2019
1 parent 357ca67 commit a19615e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion types.cc
Expand Up @@ -1471,7 +1471,7 @@ class varint_type_impl : public concrete_type<boost::multiprecision::cpp_int> {
}
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) {
Expand Down

0 comments on commit a19615e

Please sign in to comment.