From a47a5ce2d6fa2ac79c348f851d04fa1650b4db72 Mon Sep 17 00:00:00 2001 From: Thiruvalluvan M G Date: Tue, 2 Apr 2024 18:40:58 +0530 Subject: [PATCH] Fixed a bug that allowed prhibited unicode values --- lang/c++/impl/json/JsonIO.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lang/c++/impl/json/JsonIO.cc b/lang/c++/impl/json/JsonIO.cc index 9ea4be66c3f..d30d1fded49 100644 --- a/lang/c++/impl/json/JsonIO.cc +++ b/lang/c++/impl/json/JsonIO.cc @@ -403,6 +403,10 @@ string JsonParser::decodeString(const string &s, bool binary) { % string(startSeq, it)); } n = 0x10000 + (((n - 0xd800) << 10) | (m - 0xdc00)); + } else if (n >= 0xdc00 && n < 0xdfff) { + throw Exception(boost::format( + "Invalid unicode sequence: %1%") + % string(startSeq, it)); } if (n < 0x80) { result.push_back(n);