diff options
author | chriseth <c@ethdev.com> | 2016-02-13 08:24:40 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2016-02-13 08:24:40 +0800 |
commit | a14185a5cb60fbaccef9beefb84da90c043eecaa (patch) | |
tree | e73e52cc423ed021e32bd89eb5f52c0ba77b6d0b | |
parent | c6c3c78327751db3e27458596394ce3533a7fcbc (diff) | |
parent | 4a837169c5163f32ac05716c927ecd87e18618bc (diff) | |
download | dexon-solidity-a14185a5cb60fbaccef9beefb84da90c043eecaa.tar.gz dexon-solidity-a14185a5cb60fbaccef9beefb84da90c043eecaa.tar.zst dexon-solidity-a14185a5cb60fbaccef9beefb84da90c043eecaa.zip |
Merge pull request #392 from chriseth/fixsegfault
Fixsegfault
-rw-r--r-- | libsolidity/analysis/TypeChecker.cpp | 3 | ||||
-rw-r--r-- | test/libsolidity/SolidityNameAndTypeResolution.cpp | 15 |
2 files changed, 18 insertions, 0 deletions
diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 756f0e4f..857d5530 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -504,6 +504,7 @@ void TypeChecker::visitManually( return; } if (parameters->size() != arguments.size()) + { typeError( _modifier.location(), "Wrong argument count for modifier invocation: " + @@ -512,6 +513,8 @@ void TypeChecker::visitManually( toString(parameters->size()) + "." ); + return; + } for (size_t i = 0; i < _modifier.arguments().size(); ++i) if (!type(*arguments[i])->isImplicitlyConvertibleTo(*type(*(*parameters)[i]))) typeError( diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp index d202942c..3ca5a6b2 100644 --- a/test/libsolidity/SolidityNameAndTypeResolution.cpp +++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp @@ -3136,6 +3136,21 @@ BOOST_AUTO_TEST_CASE(conditional_with_all_types) BOOST_CHECK(success(text)); } +BOOST_AUTO_TEST_CASE(constructor_call_invalid_arg_count) +{ + // This caused a segfault in an earlier version + char const* text = R"( + contract C { + function C(){} + } + contract D is C { + function D() C(5){} + } + )"; + + BOOST_CHECK(expectError(text) == Error::Type::TypeError); +} + BOOST_AUTO_TEST_CASE(index_access_for_bytes) { char const* text = R"( |