From fa0798423438e71b1de60de0018194f3c4fbcf6a Mon Sep 17 00:00:00 2001 From: John Jones Date: Mon, 21 Jan 2019 09:11:11 -0500 Subject: [PATCH] fix overly agressive cleanup --- include/fc/io/raw.hpp | 1 + include/fc/io/raw_fwd.hpp | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) 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;