diff --git a/include/fc/io/raw.hpp b/include/fc/io/raw.hpp index 15c6bad..c9d344d 100644 --- a/include/fc/io/raw.hpp +++ b/include/fc/io/raw.hpp @@ -261,6 +261,7 @@ namespace fc { template inline void unpack( Stream& s, std::vector& value, uint32_t _max_depth ) { FC_ASSERT( _max_depth > 0 ); unsigned_int size; fc::raw::unpack( s, size, _max_depth - 1 ); + FC_ASSERT( size.value < MAX_ARRAY_ALLOC_SIZE ); value.resize(size.value); if( value.size() ) s.read( value.data(), value.size() ); diff --git a/include/fc/io/raw_fwd.hpp b/include/fc/io/raw_fwd.hpp index 638e559..8267afc 100644 --- a/include/fc/io/raw_fwd.hpp +++ b/include/fc/io/raw_fwd.hpp @@ -1,4 +1,4 @@ -#pragma once +#pragma once #include #include #include @@ -12,6 +12,8 @@ #include #include +#define MAX_ARRAY_ALLOC_SIZE (1024*1024*10) + namespace fc { class time_point; class time_point_sec;