diff options
author | chriseth <chris@ethereum.org> | 2017-08-15 00:59:17 +0800 |
---|---|---|
committer | chriseth <chris@ethereum.org> | 2017-08-15 04:19:15 +0800 |
commit | 32e43477c336c9180eedd6ad968595e33ecde704 (patch) | |
tree | a0c3b63ca9519132c9da8aa0fd229b66dd99aa55 /test/libsolidity | |
parent | bcce31b548870c323747085676f118b5b46ed234 (diff) | |
download | dexon-solidity-32e43477c336c9180eedd6ad968595e33ecde704.tar.gz dexon-solidity-32e43477c336c9180eedd6ad968595e33ecde704.tar.zst dexon-solidity-32e43477c336c9180eedd6ad968595e33ecde704.zip |
Prevent too deep recursion in parser.
Diffstat (limited to 'test/libsolidity')
-rw-r--r-- | test/libsolidity/SolidityParser.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityParser.cpp b/test/libsolidity/SolidityParser.cpp index 23276fcd..30dc80d9 100644 --- a/test/libsolidity/SolidityParser.cpp +++ b/test/libsolidity/SolidityParser.cpp @@ -1387,6 +1387,18 @@ BOOST_AUTO_TEST_CASE(recursion_depth3) CHECK_PARSE_ERROR(text, "Maximum recursion depth reached during parsing"); } +BOOST_AUTO_TEST_CASE(recursion_depth4) +{ + string text("contract C { function f() { uint a;"); + for (size_t i = 0; i < 30000; i++) + text += "("; + text += "a"; + for (size_t i = 0; i < 30000; i++) + text += "++)"; + text += "}}"; + CHECK_PARSE_ERROR(text, "Maximum recursion depth reached during parsing"); +} + BOOST_AUTO_TEST_CASE(declaring_fixed_and_ufixed_variables) { char const* text = R"( |