Skip to content

Commit

Permalink
Merge pull request #2405 from AntelopeIO/gh_2330_5.0
Browse files Browse the repository at this point in the history
[5.0] Fix issue #2330 by limiting the vector size that can be reserve'd
  • Loading branch information
greg7mdp authored Aug 20, 2024
2 parents fffa3d5 + dbc6f0b commit dcbdb86
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libraries/chain/abi_serializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<fc::variant> 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);
Expand Down

0 comments on commit dcbdb86

Please sign in to comment.