handled when size exceed uint32 (#5515)

* handled when size exceed uint32

Signed-off-by: dsp0redy <saipraneethreddy.dadireddy@gmail.com>

* addressed review comments

Signed-off-by: dsp0redy <saipraneethreddy.dadireddy@gmail.com>

* updated unit test

Signed-off-by: dsp0redy <saipraneethreddy.dadireddy@gmail.com>

* added amalgamation patch

Signed-off-by: dsp0redy <saipraneethreddy.dadireddy@gmail.com>

---------

Signed-off-by: dsp0redy <saipraneethreddy.dadireddy@gmail.com>
This commit is contained in:
Dadi Reddy Sai Praneeth Reddy
2026-09-27 14:17:32 +02:00
committed by GitHub
parent f422b753cc
commit fe4a544c7e
3 changed files with 208 additions and 0 deletions
+20
View File
@@ -20095,6 +20095,11 @@ class binary_writer
oa.write_character(to_char_type(0xDB));
write_number(static_cast<std::uint32_t>(N));
}
else
{
JSON_THROW(out_of_range::create(412, concat("MessagePack size ", std::to_string(N), " exceeds maximum of ",
std::to_string((std::numeric_limits<std::uint32_t>::max)())), &j));
}
// step 2: write the string
oa.write_characters(
@@ -20124,6 +20129,11 @@ class binary_writer
oa.write_character(to_char_type(0xDD));
write_number(static_cast<std::uint32_t>(N));
}
else
{
JSON_THROW(out_of_range::create(412, concat("MessagePack size ", std::to_string(N), " exceeds maximum of ",
std::to_string((std::numeric_limits<std::uint32_t>::max)())), &j));
}
// step 2: write each element
for (const auto& el : *j.m_data.m_value.array)
@@ -20201,6 +20211,11 @@ class binary_writer
oa.write_character(to_char_type(output_type));
write_number(static_cast<std::uint32_t>(N));
}
else
{
JSON_THROW(out_of_range::create(412, concat("MessagePack size ", std::to_string(N), " exceeds maximum of ",
std::to_string((std::numeric_limits<std::uint32_t>::max)())), &j));
}
// step 1.5: if this is an ext type, write the subtype
if (use_ext)
@@ -20242,6 +20257,11 @@ class binary_writer
oa.write_character(to_char_type(0xDF));
write_number(static_cast<std::uint32_t>(N));
}
else
{
JSON_THROW(out_of_range::create(412, concat("MessagePack size ", std::to_string(N), " exceeds maximum of ",
std::to_string((std::numeric_limits<std::uint32_t>::max)())), &j));
}
// step 2: write each element
for (const auto& el : *j.m_data.m_value.object)