From 1339d6b683d3fb9d31efdf2b18d84ea36cac54c4 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Mon, 20 Jul 2020 22:40:28 +0200 Subject: [PATCH] :bug: add missing EOF check --- include/nlohmann/detail/input/binary_reader.hpp | 4 ++++ single_include/nlohmann/json.hpp | 4 ++++ 2 files changed, 8 insertions(+) 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); }