Use value_in_range_of trait

This commit is contained in:
Florian Albrechtskirchinger 2022-06-08 09:20:18 +02:00
parent 329e1871f7
commit d84ac2a148
No known key found for this signature in database
GPG Key ID: 19618CE9B2D4BE6D
2 changed files with 4 additions and 4 deletions

View File

@ -2079,7 +2079,7 @@ class binary_reader
return sax->parse_error(chars_read, get_token_string(), parse_error::create(113, chars_read,
exception_message(input_format, "count in an optimized container must be positive", "size"), nullptr));
}
if (number > std::numeric_limits<std::size_t>::max())
if (!value_in_range_of<std::size_t>(number))
{
return sax->parse_error(chars_read, get_token_string(), parse_error::create(408, chars_read,
exception_message(input_format, "integer value overflow", "size"), nullptr));
@ -2129,7 +2129,7 @@ class binary_reader
{
return false;
}
if (number > std::numeric_limits<std::size_t>::max())
if (!value_in_range_of<std::size_t>(number))
{
return sax->parse_error(chars_read, get_token_string(), parse_error::create(408, chars_read,
exception_message(input_format, "integer value overflow", "size"), nullptr));

View File

@ -10764,7 +10764,7 @@ class binary_reader
return sax->parse_error(chars_read, get_token_string(), parse_error::create(113, chars_read,
exception_message(input_format, "count in an optimized container must be positive", "size"), nullptr));
}
if (number > std::numeric_limits<std::size_t>::max())
if (!value_in_range_of<std::size_t>(number))
{
return sax->parse_error(chars_read, get_token_string(), parse_error::create(408, chars_read,
exception_message(input_format, "integer value overflow", "size"), nullptr));
@ -10814,7 +10814,7 @@ class binary_reader
{
return false;
}
if (number > std::numeric_limits<std::size_t>::max())
if (!value_in_range_of<std::size_t>(number))
{
return sax->parse_error(chars_read, get_token_string(), parse_error::create(408, chars_read,
exception_message(input_format, "integer value overflow", "size"), nullptr));