mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Tests for recursion exploit in parser.
This commit is contained in:
parent
2411f5d839
commit
bcce31b548
@ -1363,6 +1363,30 @@ BOOST_AUTO_TEST_CASE(conditional_with_assignment)
|
||||
BOOST_CHECK(successParse(text));
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(recursion_depth1)
|
||||
{
|
||||
string text("contract C { bytes");
|
||||
for (size_t i = 0; i < 30000; i++)
|
||||
text += "[";
|
||||
CHECK_PARSE_ERROR(text.c_str(), "Maximum recursion depth reached during parsing");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(recursion_depth2)
|
||||
{
|
||||
string text("contract C { function f() {");
|
||||
for (size_t i = 0; i < 30000; i++)
|
||||
text += "{";
|
||||
CHECK_PARSE_ERROR(text, "Maximum recursion depth reached during parsing");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(recursion_depth3)
|
||||
{
|
||||
string text("contract C { function f() { uint x = f(");
|
||||
for (size_t i = 0; i < 30000; i++)
|
||||
text += "(";
|
||||
CHECK_PARSE_ERROR(text, "Maximum recursion depth reached during parsing");
|
||||
}
|
||||
|
||||
BOOST_AUTO_TEST_CASE(declaring_fixed_and_ufixed_variables)
|
||||
{
|
||||
char const* text = R"(
|
||||
|
Loading…
Reference in New Issue
Block a user