serialization: fail on read_varint error

This commit is contained in:
moneromooo-monero 2019-03-11 23:36:17 +00:00
parent 68ad548193
commit db2b9fba65
No known key found for this signature in database
GPG key ID: 686F07454D6CEFC3

View file

@ -146,7 +146,8 @@ struct binary_archive<false> : public binary_archive_base<std::istream, false>
void serialize_uvarint(T &v)
{
typedef std::istreambuf_iterator<char> it;
tools::read_varint(it(stream_), it(), v); // XXX handle failure
if (tools::read_varint(it(stream_), it(), v) < 0)
stream_.setstate(std::ios_base::failbit);
}
void begin_array(size_t &s)