Skip to content

Commit 90f8ad5

Browse files
committed
Ported test case from STEEM
1 parent fb75dc9 commit 90f8ad5

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/serialization_test.cpp

+20
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,24 @@ BOOST_AUTO_TEST_CASE( nested_objects_test )
102102

103103
} FC_CAPTURE_LOG_AND_RETHROW ( (0) ) }
104104

105+
BOOST_AUTO_TEST_CASE( unpack_recursion_test )
106+
{
107+
try
108+
{
109+
std::stringstream ss;
110+
int recursion_level = 100000;
111+
uint64_t allocation_per_level = 500000;
112+
113+
for ( int i = 0; i < recursion_level; i++ )
114+
{
115+
fc::raw::pack( ss, fc::unsigned_int( allocation_per_level ) );
116+
fc::raw::pack( ss, static_cast< uint8_t >( fc::variant::array_type ) );
117+
}
118+
119+
std::vector< fc::variant > v;
120+
BOOST_REQUIRE_THROW( fc::raw::unpack( ss, v ), fc::assert_exception );
121+
}
122+
FC_LOG_AND_RETHROW();
123+
}
124+
105125
BOOST_AUTO_TEST_SUITE_END()

0 commit comments

Comments
 (0)