diff --git a/include/nlohmann/detail/input/binary_reader.hpp b/include/nlohmann/detail/input/binary_reader.hpp index 6f06856a..9085f1cb 100644 --- a/include/nlohmann/detail/input/binary_reader.hpp +++ b/include/nlohmann/detail/input/binary_reader.hpp @@ -2016,6 +2016,10 @@ class binary_reader for (std::size_t i = 0; i < size; ++i) { get(); + if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(input_format_t::ubjson, "number"))) + { + return false; + } number_vector.push_back(current); } diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 0b9c4edb..0d60de15 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -9516,6 +9516,10 @@ class binary_reader for (std::size_t i = 0; i < size; ++i) { get(); + if (JSON_HEDLEY_UNLIKELY(!unexpect_eof(input_format_t::ubjson, "number"))) + { + return false; + } number_vector.push_back(current); }