BSON: throw json.exception.out_of_range.407 in case a value of type std::uint64_t
is serialized to BSON. Also, added a missing EOF-check to binary_reader.
This commit is contained in:
parent
df0f612d1b
commit
5bccacda30
5 changed files with 376 additions and 6 deletions
|
@ -800,11 +800,16 @@ class binary_writer
|
|||
write_bson_entry_header(name, 0x10); // int32
|
||||
write_number<std::int32_t, true>(static_cast<std::int32_t>(value));
|
||||
}
|
||||
else
|
||||
else if (value <= static_cast<std::uint64_t>((std::numeric_limits<std::int64_t>::max)()))
|
||||
{
|
||||
write_bson_entry_header(name, 0x12); // int64
|
||||
write_number<std::int64_t, true>(static_cast<std::int64_t>(value));
|
||||
}
|
||||
else
|
||||
{
|
||||
JSON_THROW(out_of_range::create(407, "number overflow serializing " + std::to_string(value)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue