Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[1.0 -> main] limit the vector size that can be reserved #605

Merged
merged 7 commits into from
Aug 20, 2024
2 changes: 1 addition & 1 deletion libraries/chain/abi_serializer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,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