From c302253417c16cfc11fce5700290fc73b1b212cf Mon Sep 17 00:00:00 2001 From: Matt Witherspoon <32485495+spoonincode@users.noreply.github.com> Date: Mon, 19 Aug 2024 16:40:08 -0400 Subject: [PATCH 1/2] fix true_lowest() for uint128[2] index --- libraries/chain/include/eosio/chain/contract_table_objects.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/chain/include/eosio/chain/contract_table_objects.hpp b/libraries/chain/include/eosio/chain/contract_table_objects.hpp index 51c06d6812..0877983e76 100644 --- a/libraries/chain/include/eosio/chain/contract_table_objects.hpp +++ b/libraries/chain/include/eosio/chain/contract_table_objects.hpp @@ -177,7 +177,7 @@ namespace eosio { namespace chain { using value_type = std::array; static value_type true_lowest() { - value_type arr; + value_type arr = {}; return arr; } From 49079ab4e324548d521604b8f64e0e706264bc70 Mon Sep 17 00:00:00 2001 From: greg7mdp Date: Tue, 20 Aug 2024 13:25:51 -0400 Subject: [PATCH 2/2] Fix issue #2330 by limiting the vector size that can be reserve'd --- libraries/chain/abi_serializer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libraries/chain/abi_serializer.cpp b/libraries/chain/abi_serializer.cpp index 1cb039fd4a..7cfeecbe75 100644 --- a/libraries/chain/abi_serializer.cpp +++ b/libraries/chain/abi_serializer.cpp @@ -415,7 +415,7 @@ namespace eosio { namespace chain { fc::raw::unpack(stream, size); } EOS_RETHROW_EXCEPTIONS( unpack_exception, "Unable to unpack size of array '${p}'", ("p", ctx.get_path_string()) ) vector vars; - vars.reserve(size); + vars.reserve(std::min(size.value, 1024u)); // limit the maximum size that can be reserved before data is read auto h1 = ctx.push_to_path( impl::array_index_path_item{} ); for( decltype(size.value) i = 0; i < size; ++i ) { ctx.set_array_index_of_path_back(i);