Skip to content

Commit

Permalink
don't attempt to handle unsigned ints over 64bit
Browse files Browse the repository at this point in the history
  • Loading branch information
slowriot committed Jan 11, 2025
1 parent f24ecf7 commit 465adfc
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions include/nlohmann/detail/output/binary_writer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1090,15 +1090,11 @@ class binary_writer
write_bson_entry_header(name, 0x10 /* int32 */);
write_number<std::int32_t>(static_cast<std::int32_t>(j.m_data.m_value.number_unsigned), true);
}
else if (j.m_data.m_value.number_unsigned <= std::numeric_limits<std::uint64_t>::max())
else
{
write_bson_entry_header(name, 0x11 /* uint64 */);
write_number<std::uint64_t>(static_cast<std::uint64_t>(j.m_data.m_value.number_unsigned), true);
}
else
{
JSON_THROW(out_of_range::create(407, concat("unsigned integer number ", std::to_string(j.m_data.m_value.number_unsigned), " cannot be represented by BSON as it does not fit into uint64"), &j));
}
}

/*!
Expand Down

0 comments on commit 465adfc

Please sign in to comment.