forked from townforge/townforge
serialization: forbid reading 0 varints from empty data
this could plausibly be useful as a tail compression scheme, but every other varint loading code treats 0 bytes read as an error, and it goes with the principle of least surprise.
This commit is contained in:
parent
4552e18249
commit
837ad9515e
@ -157,7 +157,7 @@ struct binary_archive<false> : public binary_archive_base<false>
|
||||
{
|
||||
auto current = bytes_.cbegin();
|
||||
auto end = bytes_.cend();
|
||||
good_ &= (0 <= tools::read_varint(current, end, v));
|
||||
good_ &= (0 < tools::read_varint(current, end, v));
|
||||
current = std::min(current, bytes_.cend());
|
||||
bytes_ = {current, std::size_t(bytes_.cend() - current)};
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user