diff options
author | chriseth <chris@ethereum.org> | 2017-08-24 17:14:01 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-24 17:14:01 +0800 |
commit | 8af6f193bcf279381df3cca51b179b48e9cf5d5d (patch) | |
tree | 145ac3b1ed28a705d79f79ffd6366f5ad93d3aff /test | |
parent | 9c74473a9b08bfc58d97a46aceb8869c24095276 (diff) | |
parent | 628b54ce351dd5de8ec34aa8c2c23f2fd0a77d90 (diff) | |
download | dexon-solidity-8af6f193bcf279381df3cca51b179b48e9cf5d5d.tar.gz dexon-solidity-8af6f193bcf279381df3cca51b179b48e9cf5d5d.tar.zst dexon-solidity-8af6f193bcf279381df3cca51b179b48e9cf5d5d.zip |
Merge pull request #2770 from ethereum/recursionInAsm
Also prevent too much recursion in the assembly parser.
Diffstat (limited to 'test')
-rw-r--r-- | test/libjulia/Parser.cpp | 12 | ||||
-rw-r--r-- | test/libsolidity/InlineAssembly.cpp | 14 |
2 files changed, 26 insertions, 0 deletions
diff --git a/test/libjulia/Parser.cpp b/test/libjulia/Parser.cpp index e1bf5a3a..51070370 100644 --- a/test/libjulia/Parser.cpp +++ b/test/libjulia/Parser.cpp @@ -237,6 +237,18 @@ BOOST_AUTO_TEST_CASE(builtin_types) BOOST_CHECK(successParse("{ let x:s256 := 1:s256 }")); } +BOOST_AUTO_TEST_CASE(recursion_depth) +{ + string input; + for (size_t i = 0; i < 20000; i++) + input += "{"; + input += "let x:u256 := 0:u256"; + for (size_t i = 0; i < 20000; i++) + input += "}"; + + CHECK_ERROR(input, ParserError, "recursion"); +} + BOOST_AUTO_TEST_SUITE_END() } diff --git a/test/libsolidity/InlineAssembly.cpp b/test/libsolidity/InlineAssembly.cpp index 8e1c304a..0debc66d 100644 --- a/test/libsolidity/InlineAssembly.cpp +++ b/test/libsolidity/InlineAssembly.cpp @@ -400,6 +400,20 @@ BOOST_AUTO_TEST_CASE(instruction_too_many_arguments) CHECK_PARSE_ERROR("{ mul(1, 2, 3) }", ParserError, "Expected ')' (\"mul\" expects 2 arguments)"); } +BOOST_AUTO_TEST_CASE(recursion_depth) +{ + string input; + for (size_t i = 0; i < 20000; i++) + input += "{"; + input += "let x := 0"; + for (size_t i = 0; i < 20000; i++) + input += "}"; + + CHECK_PARSE_ERROR(input, ParserError, "recursion"); +} + + + BOOST_AUTO_TEST_SUITE_END() BOOST_AUTO_TEST_SUITE(Printing) |