mirror of
https://github.com/nlohmann/json.git
synced 2026-10-10 16:37:14 +00:00
State the exact input size limit of json_document
The check rejects inputs of 0xFFFFFFF0 bytes or more, but the exception message and the documentation said 4 GiB. Name the limit once (max_input_size), and state 4 GiB minus 16 bytes in the message and the documentation. Test the limit with a container that only claims the size. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
8 files changed
+51
-11
No files matched your search
@@ -475,9 +475,9 @@ class basic_json_document
|
||||
d.discarded = true;
|
||||
detail::view::parse_failure failure;
|
||||
bool ok = false;
|
||||
if (NLOHMANN_VIEW_UNLIKELY(size >= 0xFFFFFFF0u))
|
||||
if (NLOHMANN_VIEW_UNLIKELY(size > detail::view::max_input_size))
|
||||
{
|
||||
failure.code = detail::view::error_code::input_too_large; // LCOV_EXCL_LINE (4 GiB)
|
||||
failure.code = detail::view::error_code::input_too_large;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user