Commit 6ff2858e authored by Matthias Vallentin's avatar Matthias Vallentin

Fix bug in varbyte decoding

parent 0a873db7
......@@ -114,7 +114,7 @@ protected:
if (traits::eq_int_type(c, traits::eof()))
return sec::end_of_stream;
low7 = static_cast<uint8_t>(traits::to_char_type(c));
x |= static_cast<T>((low7 & 0x7F) << (7 * n));
x |= static_cast<T>((low7 & 0x7F)) << (7 * n);
++n;
} while (low7 & 0x80);
return none;
......
......@@ -453,4 +453,17 @@ CAF_TEST(byte_sequence_optimization) {
[](uint8_t c) { return c == 0x2a; }));
}
CAF_TEST(long_sequences) {
std::vector<char> data;
binary_serializer sink{nullptr, data};
size_t n = 12345678900ul;
sink.begin_sequence(n);
sink.end_sequence();
binary_deserializer source{nullptr, data};
size_t m = 0;
source.begin_sequence(m);
source.end_sequence();
CAF_CHECK_EQUAL(n, m);
}
CAF_TEST_FIXTURE_SCOPE_END()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment