From 49079ab4e324548d521604b8f64e0e706264bc70 Mon Sep 17 00:00:00 2001 From: greg7mdp Date: Tue, 20 Aug 2024 13:25:51 -0400 Subject: [PATCH] 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);