mirror of
https://github.com/nlohmann/json.git
synced 2025-07-28 12:02:00 +03:00
* BJData dimension length can not be string_t::npos, fix #3541 * handle error messages on 32bit machine * add explanation to why size can not be string_t::npos * add test cases to 32bit unit test Co-authored-by: Florian Albrechtskirchinger <falbrechtskirchinger@gmail.com>
This commit is contained in:
@ -10879,7 +10879,7 @@ class binary_reader
|
||||
for (auto i : dim)
|
||||
{
|
||||
result *= i;
|
||||
if (result == 0) // because dim elements shall not have zeros, result = 0 means overflow happened
|
||||
if (result == 0 || result == string_t::npos) // because dim elements shall not have zeros, result = 0 means overflow happened; it also can't be string_t::npos as it is used to initialize size in get_ubjson_size_type()
|
||||
{
|
||||
return sax->parse_error(chars_read, get_token_string(), out_of_range::create(408, exception_message(input_format, "excessive ndarray size caused overflow", "size"), nullptr));
|
||||
}
|
||||
|
Reference in New Issue
Block a user