From 2ca8dabeb91101da5fa19b6ed1dc20fc51c44174 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Sun, 18 Dec 2022 17:04:51 +0100 Subject: [PATCH] Remove a magic number (#3888) --- include/nlohmann/detail/output/serializer.hpp | 2 +- single_include/nlohmann/json.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/nlohmann/detail/output/serializer.hpp b/include/nlohmann/detail/output/serializer.hpp index a7dab5cd6..02bfaa548 100644 --- a/include/nlohmann/detail/output/serializer.hpp +++ b/include/nlohmann/detail/output/serializer.hpp @@ -927,7 +927,7 @@ class serializer : (0xFFu >> type) & (byte); const std::size_t index = 256u + static_cast(state) * 16u + static_cast(type); - JSON_ASSERT(index < 400); + JSON_ASSERT(index < utf8d.size()); state = utf8d[index]; return state; } diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index e11f52968..d419f44fe 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -18849,7 +18849,7 @@ class serializer : (0xFFu >> type) & (byte); const std::size_t index = 256u + static_cast(state) * 16u + static_cast(type); - JSON_ASSERT(index < 400); + JSON_ASSERT(index < utf8d.size()); state = utf8d[index]; return state; }