1
0
mirror of https://github.com/nlohmann/json.git synced 2025-07-13 20:21:48 +03:00

added missing overflow check for #329

This commit is contained in:
Niels
2016-10-13 21:00:48 +02:00
parent 67b9f1936d
commit d91067220f
4 changed files with 21 additions and 1 deletions

View File

@ -8257,6 +8257,13 @@ class basic_json
{
// parse with strtod
result.m_value.number_float = str_to_float_t(static_cast<number_float_t*>(nullptr), NULL);
// replace infinity and NAN by null
if (not std::isfinite(result.m_value.number_float))
{
type = value_t::null;
result.m_value = basic_json::json_value();
}
}
// save the type